|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: XPath Expressions inside a variable
[Richard Garcia]
> I am trying to build following element (which works):
>
> <xsl:for-each select="document('mydoc.xml')/FirstSibling">
> <xsl:copy-of select="Row" />
> </xsl:for-each>
>
> I'm trying to parse a information to access a 2nd input document and path.
> My input source (*.xml) looks like this:
>
> <Portlet src="mydoc.xml" path="FirstSibling"/>
>
> I tried:
>
> <xsl:variable name="src" select="Portlet/@src" />
> <xsl:variable name="path" select="Portlet/@path" />
> <xsl:for-each select="document($src)/{$path}">
> <xsl:copy-of select="Row" />
> </xsl:for-each>
>
> But this doesn't work as it doesn't like the data type for $path. How can
I
> accomplish my desired result?
> Is it possible to do this with just one variable? or no variables?
>
You can't use a variable there, but you can get the desired effect this way:
<xsl:for-each select="document($src)/*[name()=$path]">
Cheers,
Tom P
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








