Non-ASCII element and attribute names appear to be output in the wrong
encoding when US-ASCII is specified in xsl:output/@encoding. A runtime
error might be due in this case.

This happens in Xalan-J 2.7.1.

No such problems exist for output encoding UTF-8 or ISO-8859-1.

C:\dev\XML\entities :: more /t2 Kaese.xsl
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0"
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>

  <xsl:output encoding="US-ASCII"/>

  <xsl:template match="@*|node()">
    <xsl:copy><xsl:apply-templates select="@*|node()"/></xsl:copy>
  </xsl:template>

</xsl:stylesheet>

C:\dev\XML\entities :: type Kaese.xml
<?xml version="1.0" encoding="iso-8859-1"?>
<Käse süß="nö">
blödes Beispiel
</Käse>

C:\dev\XML\entities :: xalan Kaese.xml Kaese.xsl
<?xml version="1.0" encoding="US-ASCII"?><Käse süß="n&#246;">
bl&#246;des Beispiel
</Käse>

Saxon 6.5 and 9.1 flag runtime errors. So does Gestalt 3.7. So do MSXML
3.0, 4.0 and 6.0. LibXSLT 1.1.24 adheres to the desired encoding but
unduely uses numerical character references in element and attribute
names.

Michael Ludwig

Reply via email to