I'm transforming some data which has attributes containing xpaths to...well, stuff. Those xpaths are being output to HTML in placeholders 'n such - all that's fine. The trouble I have is in using those paths during the transformation.
For example, let's say one of those xpaths points to data within the xml being transformed. From my template I want to output the value resolved from the xpath, not the xpath itself. If I did [xsl:select value="@xpath"/] I wouldn't get the data, I'd get the xpath as text. The only thing I could think of was to bung some javascript in there, and then I basically use something like [xsl:select value="userfn:getDataValue[@xpath)"/].
Now, what if that xpath pointed me not to a single item of data, but to a node list? In other words, what if I wanted to do something like [xsl:for-each select="@xpath"]. Remember - I don't want to find the @xpath attribute in the current context - I want to use the value within @xpath to find a node list.
Things I've tried:
- putting the value of @xpath into an [xsl] and using $xpath in the select. Tells me it should contain a nodeList.
- Another function that takes the value, performs a selectNodes on /, and returns the result. Parser doesn't seem to like my function returning nodeLists though.
Anyone have a simple and neat solution to this?
Edit - had to square bracket those tags cause they weren't being rendered. You know what I mean though right?
[This message was edited by Twit on March 05, 2002 at 23:36.]
For example, let's say one of those xpaths points to data within the xml being transformed. From my template I want to output the value resolved from the xpath, not the xpath itself. If I did [xsl:select value="@xpath"/] I wouldn't get the data, I'd get the xpath as text. The only thing I could think of was to bung some javascript in there, and then I basically use something like [xsl:select value="userfn:getDataValue[@xpath)"/].
Now, what if that xpath pointed me not to a single item of data, but to a node list? In other words, what if I wanted to do something like [xsl:for-each select="@xpath"]. Remember - I don't want to find the @xpath attribute in the current context - I want to use the value within @xpath to find a node list.
Things I've tried:
- putting the value of @xpath into an [xsl] and using $xpath in the select. Tells me it should contain a nodeList.
- Another function that takes the value, performs a selectNodes on /, and returns the result. Parser doesn't seem to like my function returning nodeLists though.
Anyone have a simple and neat solution to this?
Edit - had to square bracket those tags cause they weren't being rendered. You know what I mean though right?
[This message was edited by Twit on March 05, 2002 at 23:36.]