I have a XML document which I need to transform to HTML. XML Content is as follows:
<root>
<enc>Sample Text : <d>Hello</d> <e>World</e></enc>
<dec>
Sample Text : <d>Hello</d> <e>World</e>
</dec>
</root>
I need to apply a template for the value in "enc" element like I have done for the "dec" element in following xslt.
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:msxsl="urn:schemas-microsoft-com:xslt" exclude-result-prefixes="msxsl"
>
<xsl:template match="root">
<html>
<body>
<xsl:apply-templates/>
</body>
</html>
</xsl:template>
<xsl:template match="dec">
<xsl:apply-templates/>
</xsl:template>
<xsl:template match="enc">
<xsl:value-of select="." disable-output-escaping="no" />
<br/>
</xsl:template>
<xsl:template match="d">
<b>
<xsl:value-of select="."/>
</b>
</xsl:template>
<xsl:template match="e">
<i>
<xsl:value-of select="."/>
</i>
</xsl:template>
</xsl:stylesheet>
Actual output for the above XSLT is:
Sample Text :
<d>Hello</d> <e>World</e>
Sample Text : Hello World
The desired output is:
Sample Text : Hello World
Sample Text : Hello World
Please help me to transform the encoded xml value with the help of XSLT only.
Thanks in advance.