[xsl] treat attribute value as xpath expression

T

Tjerk Wolterink

I have xml like this:

<data>
<binding nodeset="/data/set1/value[@name='a']"/>
<set1>
<value name="a" value="3"/>
</set1>
</data>


is it possible with an xsl styelsheet to do something like this

<xsl:template match="binding">
<xsl:variable name="bounded-nodeset"
value="eval-xpath(./binding/@nodeset)"/>

</xsl:template>



Hope you understand what i mean.
 
M

Martin Honnen

Tjerk said:
is it possible with an xsl styelsheet to do something like this

<xsl:template match="binding">
<xsl:variable name="bounded-nodeset"
value="eval-xpath(./binding/@nodeset)"/>

Certainly not in XPath 1.0 as specified as a W3C recommendation. But
some processors provide extension functions for that, for example Saxon
6.5 has
<http://saxon.sourceforge.net/saxon6.5.5/extensions.html#evaluate>

EXSLT also has
<http://www.exslt.org/dyn/functions/evaluate/index.html> and lists
Xalan-Java, 4XSLT, and libxslt as supporting that.
 
F

Florent Georges

Martin said:
Tjerk Wolterink wrote:
Certainly not in XPath 1.0 as specified as a W3C recommendation. But
some processors provide extension functions for that

A two-passes transformation can help, in some cases. The first pass
create a new stylesheet containing the XPath expression. The second
pass executes the created stylesheet.

--drkm
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,012
Latest member
RoxanneDzm

Latest Threads

Top