我需要遍历对象列表并在 xslt 中比较它们。如果找到匹配项,我需要停止处理文档。如果我到达列表的末尾并且没有找到匹配项,那么我需要处理文档。问题是 xslt 变量一旦声明就不能更改。这将是一个简单的 For 循环,在其他常用语言中具有真/假变量。
<!--I need to iterate through this list-->
<xsl:variable name="exclude">
<exclude block="999" />
<exclude block="111" />
</xsl:variable>
<xsl:template match="@*|node()">
<xsl:copy>
<xsl:apply-templates select="@*|node()" />
</xsl:copy>
</xsl:template>
<!-- Here I iterate through the docs, but I don't iterate though the objects in the list.The main problem is I don't know how to search the list and make a decision at the end or when I encounter a match. This code only works on the first object "999" -->
<xsl:template match="/">
<xsl:if test="not(contains($url, exsl:node-set($exclude)/exclude/@block))">
<xsl:copy-of select="." />
</xsl:if>
</xsl:template>