|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Length of a variable?
> <xsl:variable name="colours" select="colour"/> > > Further on in the stylesheet, there is to be a branch on whether > $colours contains any colur elements or not. You are almost there. You are setting $colours to a node-set containing the colour elements which are the children of the context node. You can then get the number of elements in $colours with count($colours). A mindset question, though: is it really necessary to store this in a variable? Not using a variable gets you out of having to test the number of colours at some point where the variable would be in scope. In general with XSL, you can frequently replace the use of a variable with the direct access to the data that XPath gives you. For example, you might do: <xsl:if test="count(../paint/colour)"> depending on the context, of course. Steve XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|
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
|

Cart








