0

There are some user defined entites in the xml data. In order to unescape those entities, we are using entity reference in the DOCTYPE mentioned in the below code:-

<!DOCTYPE xsl:stylesheet [
<!ENTITY sect "&amp;sect;">
]>
<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="&#x2014;" string="&amp;mdash;"/>
<xsl:output-character character="&amp;" string="&amp;amp;" />
<xsl:output-character character="&quot;" string="&amp;quot;" />
<xsl:output-character character="&apos;" string="&amp;apos;" />
<xsl:output-character character="&sect;" string="&amp;sect;" />
</xsl:character-map>
<!--=================================================================-->
<xsl:template match="@* | node()">
<!--=================================================================-->
<xsl:copy>
<xsl:apply-templates select="@* | node()"/>
</xsl:copy>
</xsl:template>
</xsl:stylesheet>

while execution, we face the below error:-

  Error at xsl:output-character on line 11 column 64
  XTSE0020: character attribute must be a single XML character

This error is for sect entity on line 11.

1 Answer 1

0

In the DTD, instead of !ENTITY sect "&amp;sect;" use !ENTITY sect "&#167;".

Sign up to request clarification or add additional context in comments.

2 Comments

There are some userdefined entities as well for which i dont see any character numeric value. How to define those entities?
@Rahul, ask that in a separate, new question, showing the necessary details. An entity replacement can of course consist of several characters in a DTD definition but the XSLT character map works on single characters only.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.