Expand description
XSLT sorting (§33, §85 Phase 8).
The <xsl:sort> element specifies sort criteria for <xsl:for-each>
and <xsl:apply-templates>.
Sorting supports:
- Multiple sort keys (primary, secondary, etc.)
- Text and numeric data types
- Ascending and descending order
- Case-order (upper-first, lower-first)
- Language-specific sorting
§UPSTREAM-PARITY
Upstream libxslt (sort.c) sorts node-sets using a qsort-like comparison
driven by xsltSortNodeSet. Each _xsltSort holds one sort key with
select, lang, data-type, order, and case-order attributes. Multiple
sort keys are chained via next, with the first being the primary key.
Comparison semantics:
data-type="number": numeric comparison (NaN sorts as NaN after all)data-type="text": byte-wise string comparison (upstream usesxmlStrcmp, extended by locale-aware comparison when available)order="descending"inverts the comparison result
Constants§
- XSLT_
SORT_ ASCENDING - Sort order constants
- XSLT_
SORT_ CASE_ LOWER_ FIRST - XSLT_
SORT_ CASE_ UPPER_ FIRST - Case order constants
- XSLT_
SORT_ DESCENDING - XSLT_
SORT_ NUMBER - XSLT_
SORT_ TEXT - Sort data type constants
Functions§
- xslt
Compare ⚠Nodes - Compare two nodes according to a chain of sort specifications.
- xslt
Compare ⚠Single - Compare two nodes according to a single sort key.
- xslt
Compile ⚠Sort - Compile a sort specification from an xsl:sort instruction node.
- xslt
Free ⚠Sort - Free a sort specification.
- xslt
Free ⚠Sort List - Free a chain of sort specifications.
- xslt
Sort ⚠Node Set - Sort a node-set according to the sort specifications.