XSLT; parse escaped text to a node-set and extract subelements

Posted by Tom W on Stack Overflow See other posts from Stack Overflow or by Tom W
Published on 2010-05-20T12:18:21Z Indexed on 2010/05/20 12:20 UTC
Read the original article Hit count: 165

Filed under:
|
|

Hello SO;

I've been fighting with this problem all day and am just about at my wit's end.

I have an XML file in which certain portions of data are stored as escaped text but are themselves well-formed XML. I want to convert the whole hierarchy in this text node to a node-set and extract the data therein. No combination of variables and functions I can think of works.

The way I'd expect it to work would be:

<xsl:variable name="a" select="InnerXML">
<xsl:for-each select="exsl:node-set($a)/*">
    'do something
</xsl:for-each>

The input element InnerXML contains text of the form

<root><element a>text</element a><element b><element c/><element d>text</element d></element b></root>

but that doesn't really matter. I just want to navigate the xml like a normal node-set.

Where am I going wrong?

© Stack Overflow or respective owner

Related posts about xslt

Related posts about xsl