我只是为了理解以下代码中变量中重复匹配的概念
<xsl:param name="privileges" as="node()" select="doc('privileges.xml')"/>
<xsl:variable name="codeps" select="$privileges//privilege[matches(., ':[0-9]+$')]/substring-after(., ':')"/>
previleges.xml 具有以下编码:
<privileges>
<privilege>Access my notices</privilege>
<privilege>Access draft notices</privilege>
<privilege>Place notice</privilege>
<privilege>Access published notices</privilege>
<privilege>Place notice of type:2903</privilege>
<privilege>Place notice of type:2413</privilege>
<privilege>Place notice of type:2803</privilege>
<privilege>Access pending notices</privilege>
<privilege>Access my account</privilege>
<privilege>Place legacy notice</privilege>
<privilege>Access my searches</privilege>
<privilege>Place notice of type:1101</privilege>
<privilege>Place notice of type:2404</privilege>
<privilege>Place notice of type:2402</privilege>
<privilege>Place notice of type:2501</privilege>
<privilege>Place notice of type:2505</privilege>
<privilege>Place notice of type:9900</privilege>
</privileges>
在这里,在下面的条件下,它是一一匹配的。
<xsl:if test="//*[@code = $codeps]">
我的疑问是,它如何在不使用 for-each 的情况下逐个匹配或匹配每个值。我用过这个,效果很好,但是,我仍然无法理解。如果假设,我打印 $codeps 的值,然后在执行匹配时打印累积值,例如 2903 2413 2803 等,然后,它完全匹配。
请帮我理解HOW
?