Reputation: 165
In XSLT, I need to get the text inside elements that have a CDATA
element inside,
For example,
<?xml version="1.0" encoding="UTF-8"?>
<document>
<elements>
<element><![CDATA[Element 1]]></element>
<element><![CDATA[Element 2]]></element>
<element><![CDATA[Element 3]]></element>
<element><![CDATA[Element 4]]></element>
<element><![CDATA[Element 5]]></element>
</elements>
</document>
And I want to be able to get the same document but without the CDATA
elements, like this:
<?xml version="1.0" encoding="UTF-8"?>
<document>
<elements>
<element>Element 1></element>
<element>Element 2></element>
<element>Element 3></element>
<element>Element 4></element>
<element>Element 5></element>
</elements>
</document>
Is there any way of doing this with XSLT?
Thank you!
Alexandre Jacinto
Upvotes: 0
Views: 178
Reputation: 114
The following piece of code should work:
<document>
<element>
<xsl:value-of select="document/element/text()">
</element>
</document>
You need to use the code for all the elements that you have. Hope this helps!
Upvotes: 0