This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Re: Using a variable for node name matching
- To: xsl-list at mulberrytech dot com
- Subject: Re: Using a variable for node name matching
- From: Steve Tinney <stinney at sas dot upenn dot edu>
- Date: Wed, 09 Feb 2000 23:28:40 -0500
- References: <14498.5918.820000.130263@menteith.com>
- Reply-To: xsl-list at mulberrytech dot com
> 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