[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

RE: [xsl] How To Execute an x-path statement stored insode an variable ?


Subject: RE: [xsl] How To Execute an x-path statement stored insode an variable ?
From: "Joe Fawcett" <joefawcett@xxxxxxxxxxx>
Date: Wed, 16 Jun 2004 14:52:24 +0100

From: Jan Kohnert <J.Kohnert@xxxxxxxxxxx>
Reply-To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
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[@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




Current Thread
Keywords