S
ShaggyMoose
I have a delimited string (value1, value2, value3 etc) and a node set
(single value text nodes). I want to compare each node in the set
against the string and return true when a match is found. If no match
is found, return false. However, I can't work out a way to do this
without the ability to re-assign variables or exit a loop early. This
isn't something I have had to attempt using XSL before. Can anyone
suggest a way to complete the template function below, or a better
method? Thanks.
<xsl:template name="has-value">
<xslaram name="strVals"/> <!-- Comma delimited string of user
roles. -->
<xslaram name="setVals"/> <!-- Node set of roles to match. -->
<xsl:for-each select="etVals">
<xsl:if test="contains($strVals, .)">
-- RETURN TRUE HERE --
</xsl:if>
</xsl:for-each>
-- RETURN FALSE HERE --
</xsl:template>
(single value text nodes). I want to compare each node in the set
against the string and return true when a match is found. If no match
is found, return false. However, I can't work out a way to do this
without the ability to re-assign variables or exit a loop early. This
isn't something I have had to attempt using XSL before. Can anyone
suggest a way to complete the template function below, or a better
method? Thanks.
<xsl:template name="has-value">
<xslaram name="strVals"/> <!-- Comma delimited string of user
roles. -->
<xslaram name="setVals"/> <!-- Node set of roles to match. -->
<xsl:for-each select="etVals">
<xsl:if test="contains($strVals, .)">
-- RETURN TRUE HERE --
</xsl:if>
</xsl:for-each>
-- RETURN FALSE HERE --
</xsl:template>