There have some userdefined entities in the input xml like &key;
and ‐
.
We have defined these entites as DOCTYPE in the below xsl:-
<!DOCTYPE xsl:stylesheet [
<!ENTITY key "&key;">
<!ENTITY hyphen "&hyphen;">
]>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:fn="http://www.w3.org/2005/xpath-functions"
exclude-result-prefixes="#all"
expand-text="yes"
version="3.0">
<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:output-character character="&key;" string="&key;" />
<xsl:output-character character="‐" string="&hyphen;" />
</xsl:character-map>
<xsl:mode on-no-match="shallow-copy"/>
</xsl:stylesheet>
Now in output as well, the entites should remain same, i.e. &key;
and ‐
.
But while using the userdefined entites defined under DOCTYPE in output character, the below error occurs:-
Static error at xsl:output-character
XTSE0020: character attribute must be a single XML character
Is there a way to use it or unescape the entities in output xml for &key;
and ‐
?