xsl-list
[Top] [All Lists]

Re: [xsl] xsl:sort descending causes attribute nodes to be created after children, causing an error

2007-01-16 06:14:08

The following issue is easy to workaround, but I am wondering if this is 
correct behavior after the XSLT 2 (or even 1) recommendation.

yes that's the expected behaviour (although of course it's nothing
really to do with the xsl:sort, a more direct case is

<x>
hello
<xsl:attribute name="x"/>


In 1.0 it's a recoverable error (with the alternative of ignoring the
attribute)

section 7.1.3
Adding an attribute to an element after children have been added to it;
implementations may either signal the error or ignore the attribute.


in 2.0 it's a hard error,

section 5.7.1
[ERR XTDE0410] It is a non-recoverable dynamic error if the result
sequence used to construct the content of an element node contains a
namespace node or attribute node that is preceded in the sequence by a
node that is neither a namespace node nor an attribute node.


Any thoughts on this? Is this behavior desired and/or required, or is 
this the processor's mistake?

It's required to allow an implemenation to start serialising the result
tree before processing is finished. If you were allowed to generate an
entire document then generate a version="2" attribute as the last node
before closing teh document element, the processor would always haveto
buffer the entire result tree in memory just in case the system did
this.

David

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