Apply transforms to XML attribute containing escaped HTML



I have some XML that looks like this:



<?xml version="1.0" encoding="UTF-8"?>
<root>
<issue xmlns:xsi="http://ift.tt/ra1lAU">
<comment text="&lt;div class=&quot;wiki text&quot;&gt;&lt;h4&gt;Tom Fenech&lt;/h4&gt;Here is a comment&lt;/div&gt;&#10;"/>
</issue>
</root>


As you can see, the text attribute in the comment node contains escaped HTML. I would like to get the contents of the attribute as XHTML, which I currently do this inside a template using:



<xsl:value-of select="@text" disable-output-escaping="yes" />


That gets me the HTML in the final output:



<div class="wiki text"><h4>Tom Fenech</h4>Here is a comment</div>


But I want to be able to extract the contents of the <h4> tag to use elsewhere. In general, it would be nice to be able to manipulate the contents of this once it has been escaped.


How do I apply further templates to the output of the <xsl:value-of />?


No comments:

Post a Comment