Re: Getting an error with a variable
variable bindings are in scope just for the element that contains your binding, so in your case it is only in scope within the xsl:for-each. So it's already gone out of scope outside the xsl:when clause. Also it is a lot more efficient to use the form <xsl:variable name="sNum" select="@no"/> as that binds sNum to the attribute whereas <xsl:variable name="sNum"> <xsl:value-of select="@no"/> </xsl:variable> makes a new root node with child a text node with string value the string value of the attribute. I think you want the h2 element to contain the @no attribute if 0=$paramVal4 and $paramVal2 otherwise, in which case no variables are needed: <h2> <xsl:value-of select="$paramVal2[not(0=$paramVal4)] | /stages[0=$paramVal4]/competition/itinerary/stage/@no" /> </h2> David
PURCHASE STYLUS STUDIO ONLINE TODAY!
Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!
Download The World's Best XML IDE!
Accelerate XML development with our award-winning XML IDE - Download a free trial today!
Subscribe in XML format