XSL,XPath: How to use xpath expression in source xml
I would like to ask for help. For example my xml source has some attribute node whose value is an xpath expression. How would I use that value as an xpath expression in my xsl?
In my case, the value of the attribute "attr" is dynamic (changing), and I want my xsl file to access the value according to the value of "attr" (an xpath expression). How can I do this? That is, how can I write the xpath expression that would select the value that the value of the "attr" points to?
In essence, I would like to have something like:
<xsl:for-each select="the xpath expression in the value of attr">, and
<xsl:value-of select="the xpath expression in the value of attr">
but how can I do this?
If you have a really simple path, it's possible to do the value-of purely in XSLT. Basically, it's a recursive template, that holds 2 variables.
1. Current Context position.
2. Current String.
Can't currently find the code for it, but am looking.
For-each is harder, and would probably require the use of either multiple templates and/or a node-set extension function.
Bookmarks