RE: ORA-XS-381-Q: Stable Sorting Performance

The XSL Working Group agreed in principle to add this feature, and asked
me to put forward a detailed specification.

This is what I propose:

The <xsl:sort> element gets a new optional attribute, stable, whose
permitted values are "yes" and "no". Like other sort attributes, it can
be an AVT.

This attribute is permitted only on the first xsl:sort element within a
"sort key specification" [i.e. of a sequence of sibling xsl:sort
elements]. A new static error condition is defined if the attribute is
present on any element after the first.

The default value is "yes".

We define that a sort specification is stable unless stable="no" is
specified on its first sort key.

The sentence:

<old>
If all the sort key values compare equal, then A will precede B in the
sorted sequence if and only if A preceded B in the initial sequence.
</old>

changes to:

<new>
If all the sort key values compare equal, then:

 * if the sort specification is stable then A will precede B in the
sorted sequence if and only if A preceded B in the initial sequence;
 
 * if the sort specification is not stable then the relative order of A
and B in the sorted sequence is implementation-dependent.
</new>

We also need to adjust the Note that follows this sentence.

Michael Kay





> -----Original Message-----
> From: public-qt-comments-request@w3.org 
> [mailto:public-qt-comments-request@w3.org] On Behalf Of Mark Scardina
> Sent: 16 February 2004 12:11
> To: public-qt-comments@w3.org
> Subject: ORA-XS-381-Q: Stable Sorting Performance
> 
> 
> 
> SECTION 13.1.1: the sorting process
> 
> "If all the sort key values compare equal, then A will 
> precede B in the sorted sequence if and only if A preceded B 
> in the initial sequence." This restriction has performance 
> consequences. Suggest adding an attribute to xsl:sort to such 
> as stable="yes|no". XQuery has this option in ORDER BY.
> 
> 
> Regards,
> Mark Scardina
> Oracle Corporation
> 

Received on Friday, 20 February 2004 16:35:48 UTC