Proposed spec text for sort properties

Here is proposed text for the sorting properties.

Steven

The sort Property

Associates a sorting property with a nodeset, ensuring that the nodeset is 
kept sorted.

Computed expression: Yes
Legal values: Any expression
Default value: none
Inheritance Rules: Does not inherit
Data binding restriction: none

If a bound-to node already has one or more sort properties, the new one is 
added at a lower-priority, so that the highest priority is the primary sort 
property, the second, the secondary sort property, and so on.

When applied to instance data, during initialisation and recalculation the 
processor assures that the nodeset is sorted according to this and the 
other sorting properties (direction, and collation) reordering as 
necessary. As a result, if direction = 'up', evaluating the expression of 
the sort property with context of any node is less than or equal to the 
evaluation of the expression in the context of the previous node, if any, 
in the nodeset, and greater than or equal to the evaluation of the 
expression in the context of the following node, if any, in the nodeset, 
and the other way round if direction = 'down'.

When applied to a control, during refresh, if necessary the processor 
reorders the displayed data in the same way.


Example

In both these cases

 <bind ref="data" sort="date">
  <bind sort="time"/>
 </bind>
and
 <bind ref="data" sort="date"/>
 <bind ref="data" sort="time"/>

the data will primarily be sorted on the date field, and with equal dates, 
sorted on the time field. 


The direction Property

Associates a sorting direction with a nodeset.

Computed expression: No
Legal values: up | down
Default value: up
Inheritance Rules: Does not inherit
Data binding restriction: none

For nodes with a sort property, this property specifies whether the sorting 
of nodes should be ascending ('up'), or descending ('down').

The collation Property

Associates a collation order with a nodeset.

Computed expression: No
Legal values: URI
Default value: none
Inheritance Rules: Does not inherit
Data binding restriction: none

For nodes with a sort property, when values are compared for sorting at a 
character level, the Unicode collating algorithm will be applied. For 
details, see [ref].



The insert Element

This action inserts items into a sequence. In brief:

ref or bind gives a target sequence;
origin gives one or more items to be inserted in the sequence (default: a 
copy of the last item of the target sequence);
at gives an index into the target sequence for the insertions (default: the 
end of the sequence);
position says whether to insert before or after the given position 
(default: after).

If the target sequence is empty (and origin is present and non-empty) the 
origin items are inserted into the context node, ignoring at and position.

Note.
If the target sequence is non-empty and has a sort property, the inserted 
node will end up at the correct position in the sort after being inserted. 
As a result, implementations are free to ignore the positioning attributes 
in such cases.

Received on Friday, 12 December 2025 11:19:59 UTC