Hi,
-----Original Message-----
From: Buchcik, Kasimier [mailto:k(_dot_)buchcik(_at_)4commerce(_dot_)de]
-----Ursprüngliche Nachricht-----
Von: G. Ken Holman [mailto:gkholman(_at_)CraneSoftwrights(_dot_)com]
Gesendet: Dienstag, 25. April 2006 22:44
An: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Betreff: Re: [xsl] xsl:for-each and xml:space with text-nodes
inbetween
[...]
Should any text-node, regardless if it's whitespace-only or not,
be reported as invalid at such a position?
Yes, it is an error, and Saxon reports it as an error, because the
xml:space="preserve" creates a node of the template before the
xsl:sort instruction, which is not allowed.
Using the MSXML .NET Processor, I get the following result:
<?xml version='1.0' encoding='utf-8' ?>
<foo> a b c</foo>
I would assess that as a bug ... the space character is
clearly part
of the template and the standard does not allow any part of the
template before xsl:sort.
then an error is reported concerning the invalid position
of xsl:sort
inside xsl:for-each. I'm confused here.
I think you are confused because of the bug.
[...]
Ah, this makes sense now.
Thank you very much for taking time for this case!
Some additional tests revealed that some other processors are
also buggy here. This produces a bit of headache on my side, since
I would like to be compatible with Saxon and Xalan-J, but it seems
like the behaviour of those processors does deviate from the spec.
I'm currently testing under Stylus Studio HE 6, so I'm not sure
how up-to-date the processors are. I'd be happy if someone could
confirm that this is the actual up-to-date behaviour of those
XSLT 1.0 processors.
Input:
<?xml version="1.0"?>
<foo>
<bar>b</bar>
<bar>c</bar>
<bar>a</bar>
</foo>
Scenario A:
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<foo>
<xsl:for-each select="/foo/bar" xml:space="preserve">i<xsl:sort
/><xsl:value-of select="."/></xsl:for-each>
</foo>
</xsl:template>
</xsl:stylesheet>
Output from Saxon 6.5.3 and Xalan-J:
<?xml version='1.0' ?>
<foo>iaibic</foo>
MSXML .NET and Libxslt report an error.
Scenario B:
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<foo>
<xsl:for-each select="/foo/bar" xml:space="preserve"> <xsl:sort
/><xsl:value-of select="."/></xsl:for-each>
</foo>
</xsl:template>
</xsl:stylesheet>
Output from Saxon 6.5.3, Xalan-J and MSXML .NET:
<?xml version='1.0' ?>
<foo> a b c</foo>
Libxslt reports an error (at transformation time).
Regards,
Kasimier
--~------------------------------------------------------------------
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>
--~--