[xsl] XPATH to be used in a for-each loop wherein the XPATH is stored in a <xsl:variable>

Subject: [xsl] XPATH to be used in a for-each loop wherein the XPATH is stored in a <xsl:variable>
From: Rahul Patwardhan <patwardhanrahul@xxxxxxxxx>
Date: Fri, 25 Jul 2003 06:10:50 -0700 (PDT)
I want to use an XPATH in a for-each loop.The XPATH is
stored in a variable as a string. I want to traverse
the XPATH in a for-each loop but i dont want to use
the (xalan:evaluate) function. Are there any other
ways of doing this?

Here is a part of my XML File on which the XPATH is
based...

<Fields>
<Field>
	<Id>1</Id>
	<LanguageProperties Languageid="1">
		<Label>SomeLabel</Label>
	</LanguageProperties>
</Field>
</Fields>


And here is my XSL..

<xsl:variable
name="PropName">LanguageProperties/Label</xsl:variable>

<xsl:variable
name="xpathvar">/Fields/Field/<xsl:value-of
select="$PropName"/></xsl:variable>
		<xsl:for-each select="xalan:nodeset($xpathvar)">
			<xsl:value-of select="."/>
		</xsl:for-each>

The problem is that the the path stored in the
PropName variable is being generated dynamically so i
wont always be 'LanguageProperties/Label'.So the
purpose of taking it in a variable.
By using "xalan:evaluate(variable_name)" my problem
will be solved, but as far as possible i dont want to
use it and it would be great if a solution to this
problem is without using "xalan:evaluate".
Thanks a lot for ur help.
Rahul



__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com

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


Current Thread