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 ‐?
<!ENTITY key "&key;">then the attribute value of e.g.character="&key;"is e.g.&key;, that is the string with five characters&,k,e,y,;. So obviously the requirement forcharacterto be a single character is not met.saxon:internal-dtd-subsetonxsl:outputin saxonica.com/html/documentation12/extensions/output-extras/…. But I agree with Michael Kay, judged by all the related questions with all the entity stuff it seems you are trying to achieve something with XSLT that is not really supported and probably not necessary (in terms of pure XSLT/XML processing).