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?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

vikasbapatAuthor Commented:
ok
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
XML

From novice to tech pro — start learning today.