[xsl] <&#220;belkeit/> - ASCIIfied element name (LibXSLT/xsltproc)

Subject: [xsl] <&#220;belkeit/> - ASCIIfied element name (LibXSLT/xsltproc)
From: Michael Ludwig <mlu@xxxxxxxxxxxxx>
Date: Thu, 03 Jul 2008 10:19:45 +0200
Any valid Unicode character is allowed in an element name,
which is great.

<Urmel>
  <Vorspeise>S|_kirschen mit Kdseso_e</Vorspeise>
  <\belkeit/>
</Urmel>

Now let's transform this encoding it in ASCII.

<xsl:transform version="1.0"
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>
  <xsl:output encoding="us-ascii"/><!-- Alles ASCII ! -->
  <xsl:template match="@*|node()">
    <xsl:copy>
      <xsl:apply-templates select="@*|node()"/>
    </xsl:copy>
  </xsl:template>
</xsl:transform>

It doesn't work using Saxon 6.5, 9, or Xalan-C.

#### Xalan-C reports an error:

SAXException Message is: 'DC' is an invalid Unicode scalar value.

#### So does Saxon 6.5:

Error at xsl:copy on line 5 of file:/home/mludwig/Werkstatt/xsl/ascii.xsl:
  Invalid character in output name (\belkeit)
Transformation failed: Run-time errors were reported

#### So does Saxon 9.0:

Error at xsl:copy on line 5 of file:/home/mludwig/Werkstatt/xsl/ascii.xsl:
SERE0008: Element name contains a character (decimal + 220) not available in the selected encoding
Transformation failed: Run-time errors were reported


#### LibXSLT (1.1.22) to the rescue!

$ xsltproc ascii.xsl ascii-soll-es-werden.xml

<?xml version="1.0" encoding="us-ascii"?>
<Urmel>
        <Vorspeise>S&#252;&#223;kirschen mit K&#228;seso&#223;e</Vorspeise>
        <&#220;belkeit/>
</Urmel>

So is LibXSLT preferable in this respect? Or would I be justified
reporting this as a bug?

Michael Ludwig

Current Thread