I’m trying to apply a transform with java (currentXSLT.transform(xmlFile, outputFile);) But I’m getting escaped text. I need the characters that are being scaped, from the text of the XML.
So far I have tried with this:
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" >
<xsl:output method="xml" indent="no" omit-xml-declaration="yes"/>
<xsl:strip-space elements="*"/>
<xsl:template match="@* | node()">
<xsl:copy>
<xsl:apply-templates select="@*|node()"/>
</xsl:copy>
</xsl:template>
<xsl:template match="text()">
<xsl:copy>
<xsl:value-of select="." disable-output-escaping="yes"/>
</xsl:copy>
</xsl:template>
</xsl:stylesheet>
But it doesn’t seem to work.
Any ideas?
Thanks.
At the end, I couldn’t do it with plain xslt, I had to use apache commons in order to unescape the text. Since it was a business requirement to keep the invalid signs, I had to find a workaround: