View Single Post
  #1 (permalink)  
Old July 2nd, 2009, 04:02 AM
tieme tieme is offline
Registered User
Points: 8, Level: 1
Points: 8, Level: 1 Points: 8, Level: 1 Points: 8, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2009
Posts: 2
Thanks: 1
Thanked 0 Times in 0 Posts
Default xsl:variable question

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

Last edited by tieme : July 2nd, 2009 at 04:06 AM.
Reply With Quote