We are using an XSL transformer to convert hexcode entity to mdash. This transformation happens as expected.
But we also have to convert all & in xml to output as &.
Right now, the output contains &.
During xsl transformation, below error is displayed:-
An attribute node cannot be created after a child of the containing element.
While using the below xsl, the error is thrown:-
<xsl:stylesheet version='1.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:character-map>
<xsl:template match="@* | node()">
<xsl:copy>
<xsl:text disable-output-escaping="yes">&</xsl:text>
<xsl:apply-templates select="@*|node()" />
</xsl:copy>
</xsl:template>
</xsl:stylesheet>
xalan.