xsl-list
[Top] [All Lists]

Re: [xsl] Evaluate string as XPATH axis in XSLT1.0?

2007-08-19 23:34:16
Matt Poff wrote:
Hi,

I'm trying to resolve a node attribute which contains an XPATH fragment to actually resolve that path to a value. Is this possible.

XML with attribute looks like...

   <grid-map map="./foo[(_at_)bar]/select" />


XSLT looks like...
<xsl:variable name="path" select="../grid/grid-map[1]/@map"/>
<xsl:value-of select="{$path}" />

the select-attribute is not an AVT and in general, an XPath cannot be interpreted, it is static. The "normal" way to go about this is to create a stylesheet that creates a (temporary) second stylesheet with the xpaths from your source and then apply that new stylesheet. Another way is to use extension functions (Saxon for one has extensions that work both in XSLT 1.0 and 2.0 that can do this).

Cheers,
-- Abel Braaksma

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--