From: Jan Kohnert <J(_dot_)Kohnert(_at_)swisslab(_dot_)de>
Reply-To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: [xsl] How To Execute an x-path statement stored insode an variable
?
Date: Wed, 16 Jun 2004 13:18:47 +0200
Hello List,
I have stored x-pathes inside an varibale:
<xsl:variable name="GetItem">
<!-- Statische Items -->
<item name="NAME" select="BOOK/@name"/>
<item name="ISBN" select="BOOK/@isbn"/>
...
</xsl:variable>
The Idea is to store the x-path inside an variable, because if the XML
changes, I dont want to rewrite alle my stylesheets. All I have to do is to
change the contant of the variable.
My problem is, that I dont really know how to use the x-path inside the
@select attribute.
If I write
<xsl:value-of select="$GetItem/item[(_at_)name = 'NAME']/@select"/>
I get the value "BOOK/@name".
How can I use this value to use this x-path with the xml file ?
Thanks!
jan
As far as I know there is no standard way of executing dynamic xpath
generically. Some systems have extension functions for doing this, Saxon has
a <prefix>:evaluate method I think, and if using msxml you could either use
script or a custom object as well.
--
Joe