Continuing on an earlier problem, I have an XML file that has an element
which will have "escaped" XML content. David Carlisle helped me
discover the "disable-output-escaping" attribute of "xsl:value-of",
which gives me a valid tree fragment.
Now, I need to convert that tree fragment to a nodeset so I can operate
on it.
I noticed the "xalan:nodeset" (and "exslt:node-set") function. I assume
this takes a tree fragment and returns a nodeset.
I tried something like this:
--------------------
<xsl:template name="genother">
<xsl:param name="others"/>
<gork/>
<xsl:for-each select="$others">
<xsl:variable name="keyValue" select="key"/>
<xsl:variable name="valueFrag">
<xsl:value-of disable-output-escaping="yes" select="value"/>
</xsl:variable>
<xsl:variable name="valueNodes">
<xsl:value-of select="xalan:nodeset($valueFrag)"/>
</xsl:variable>
<xsl:for-each select="$valueNodes">
...
--------------------
The "<gork/>" is just a flag to make sure I got there.
When I run this stylesheet on my XML (using xalanj 2.5.1), I get the
following:
SystemId Unknown; Line #0; Column #0; XSLT Error
(org.apache.xpath.XPathException): Can not convert #STRING to a
NodeList!
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list