This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Using a variable for node name matching


> In the stylesheet below, can "$startnode" be used for node matching,
> instead of having to type in the whole string ( TEST/TEST1/TEST2 )
>  everytime ?
> 
> <xsl:variable name="startnode">
> <xsl:text>TEST/TEST1/TEST2</xsl:text>
> </xsl:variable>

Not really.  You can go some way towards this by storing a node-set in a
variable and using that as the initial element of a path, but it doesn't
quite have the effect you are looking for.

So, you could say:

     <xsl:variable name="startnode" select="test/test1/test2"/>
     <xsl:for-each select="$startnode/some/other/nodes">
     ...
     </xsl:for-each>

but the variable mechanism is not as flexible as what you are asking
about.  I wish it were.

 Steve


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]