How to preserve HTML tags in XML node value while converting data to uppercase using XSLT "translate" function?

Hello,

I need to convert source XML file to destination XML format using XSLT 2.0 and during this conversion, I have to convert data in a specific node to uppercase but the problem is the text in this node contains HTML tags. I'm able to display value of that specific node containing HTML tags using XPath as "DESC/node()" where 'DESC' is the node in source XML file. The text in the 'DESC' node is somewhat like -

<DESC>This is sample text to be converted to uppercase <sub>2</sub> times a <sup>day</sup> every week</DESC>

I need the output in destination XML as -
<desc type="mod">THIS IS SAMPLE TEXT TO BE CONVERTED TO UPPERCASE <sub>2</sub> TIMES A <sup>DAY</sup> EVERY WEEK</desc>

Note - HTML tags should remain lowercase only while rest of the text should be converted to uppercase as shown here

This is my XSL declaration -
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" encoding="UTF-8" cdata-section-elements="text" omit-xml-declaration="no"/>

and this the line where I'm using 'translate' function -
<xsl:variable name="lowercase">abcdefghijklmnopqrstuvwxyz</xsl:variable>
<xsl:variable name="uppercase">ABCDEFGHIJKLMNOPQRSTUVWXYZ</xsl:variable>
<xsl:value-of select="translate($temp1,$lowercase,$lowercase)"/>

When I apply transform on source XML, the output of DESC node comes out without HTML tags as -
<desc type="mod">THIS IS SAMPLE TEXT TO BE CONVERTED TO UPPERCASE 2 TIMES A DAY EVERY WEEK</desc>

I tried with possible combinations but no luck. What might be the reason for this? Does the translate function automatically removes html tags?

regards
vikasbapatAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
vikasbapatConnect With a Mentor Author Commented:
ok
0
All Courses

From novice to tech pro — start learning today.