I have an XML file which is transformed with XSL. Some elements have to be changed, some have to be left as is - specifically, text with entities ", &, ', <, > should be left as is, and in my case " and ' are changed to " and ' accordingly.
Test XML:
<?xml version="1.0" encoding="UTF-8" ?>
<root>
<element>
"
&
'
<
>
</element>
</root>
transformation file:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output method="xml" encoding="UTF-8" omit-xml-declaration="no" indent="no" />
<xsl:template match="element">
<xsl:copy>
<xsl:value-of disable-output-escaping="no" select="." />
</xsl:copy>
</xsl:template>
</xsl:stylesheet>
result:
<?xml version="1.0" encoding="UTF-8"?>
<element>
"
&
'
<
>
</element>
desired result:
<?xml version="1.0" encoding="UTF-8"?>
<element>
"
&
'
<
>
</element>
I have 2 questions:
why does some of those entities are transformed and other not?
how can I get a desired result?