xsl-list
[Top] [All Lists]

[xsl] xsl:for-each and xml:space with text-nodes inbetween

2006-04-25 12:45:56
Hi,

Does someone know what an XSLT 1.0 processor is expected
to do if the immediate child-node of an xsl:for-each is
a whitespace-only text node, which is preserved by xml:space?
Should any text-node, regardless if it's whitespace-only or not,
be reported as invalid at such a position?

Example

Stylesheet:
<?xml version='1.0'?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>
        <xsl:template match="/">
                <foo>
                <!-- There's whitespace between xsl:for-each and
xsl:sort. -->
                <xsl:for-each select="/foo/bar" xml:space="preserve">
<xsl:sort /><xsl:value-of select="."/></xsl:for-each>
                </foo>
        </xsl:template>
</xsl:stylesheet>

Input:
<?xml version="1.0"?>
<foo>
  <bar>b</bar>
  <bar>c</bar>
  <bar>a</bar>
</foo>

Using the MSXML .NET Processor, I get the following result:

<?xml version='1.0' encoding='utf-8' ?>
<foo> a b c</foo>

If I change the whitespace-only text-node to contain a letter: 
...
<xsl:for-each select="/foo/bar" xml:space="preserve">X<xsl:sort
/><xsl:value-of select="."/></xsl:for-each>
...
then an error is reported concerning the invalid position of xsl:sort
inside xsl:for-each. I'm confused here.

Was this maybe clarified in the XSLT 2.0 spec?

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>
--~--

<Prev in Thread] Current Thread [Next in Thread>