xsl-list
[Top] [All Lists]

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

2008-07-03 01:20:16
Any valid Unicode character is allowed in an element name,
which is great.

<Urmel>
  <Vorspeise>Süßkirschen mit Käsesoß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

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--