[xslt] xml:space



Hi there,

consider the following stylesheet:

  <?xml version="1.0"?>
  <xsl:stylesheet version="1.0"
      xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>
    <xsl:template match="/">
      <elem xml:space="preserve">
      <xsl:choose>
        <xsl:when test="true">
          <true/>
        </xsl:when>
      </xsl:choose>
      </elem>
    </xsl:template>
  </xsl:stylesheet>

Run with any XML document, xsltproc produces:

  C:\Home\Igor\tmp> xsltproc tmp.xsl tmp.xml
  runtime error: file tmp.xsl line 6 element choose
  xsl:choose: xsl:when expected first
  no result for tmp.xml

Means, libxslt wants the xsl:when element to be the first child of
xsl:choose. It does not allow a text node at that position.

When the 'xsl:space' attribute in <elem> is removed, or set to something
other than "preserve", the stylesheet is processed correctly.

If I interpret the specs correctly, this is not right. Transformation with
MSXSL and Xalan confirms this. Both processors transform the stylesheet,
having a different output depending on the value if xml:space. They don't
complain about the text node.

Before I dive into fixing this, I would know if it really is a bug, or are
MSXSL, Xalan and my interpretetion of the specs somewhat wrong. :-)

Ciao,
Igor




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]