Subject: Re: Length of a variable? From: Steve Tinney <stinney@xxxxxxxxxxxxx> Date: Wed, 15 Mar 2000 13:58:33 -0500 |
> <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
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Length of a variable?, nigel . byrnes | Thread | Re: Length of a variable?, nigel . byrnes |
IE5, menkell | Date | Re: MSXML abominations happening fo, Seth Ladd |
Month |