We have done an xsl transformation to convert hexcode values into entities.
Now after transformation, there are some entites which are converting into their corresponding values like &
gets converted into '&', similar is the case for §
.
For keeping the entities unchanged, we have used the below xsl code:-
<xsl:stylesheet version='3.0' xmlns:xsl='http://www.w3.org/1999/XSL/Transform' >
<xsl:output method="xml" omit-xml-declaration="no" use-character-maps="mdash" />
<xsl:character-map name="mdash">
<xsl:output-character character="—" string="&mdash;"/>
<xsl:output-character character="&" string="&amp;" />
<xsl:output-character character=""" string="&quot;" />
<xsl:output-character character="'" string="&apos;" />
<xsl:output-character character="§" string="&sect;" />
</xsl:character-map>
<!--=================================================================-->
<xsl:template match="@* | node()">
<!--=================================================================-->
<xsl:copy>
<xsl:apply-templates select="@* | node()"/>
</xsl:copy>
</xsl:template>
</xsl:stylesheet>
Now transformation happens fine for most of the entities, but for §, the below error is displayed:-
SXXP0003: Error reported by XML parser: The entity "sect" was referenced, but not declared.
Is there a way to unescape this entity sect?
Use a numeric character reference e.g. §
:
<xsl:output-character character="§" string="&sect;" />