I am trying to use xsl:variable to clean up my code a bit, but I can't quite get it to work how I want it to.
The code is pretty ugly due to huge xPath expressions (main reason I want to use variables) so I'll just show you the code with the long paths changed to short ones.
I am looking for a more concise way to get the functionality of this code:
Code:
<xsl:if text="count(foo2/bar2[foo/bar = 'CNTY1' or foo/bar = 'CNTY2']) = 0">
<!-- code here -->
</xsl:if>
Code:
<xsl:variable name="countyPath" select="'foo/bar'" />
<xsl:variable name="allCountyPath" select="$countyPath = 'CNTY1' or $countyPath = 'CNTY2'/>
.
.
.
<xsl:if test="count(foo2/bar2[allCountyPath]) = 0">
<!-- code here -->
</xsl:if>
I've tried removing the inner single quotes from the select attribute on the countyPath variable but it doesn't seem to help. Even though there are counties there, it seems to return 0.
Any ideas on where to go from here?
Edit:Sorry for the generic title, was going to try to make it more descriptive but I can't seem to edit it.
Thanks!
John