|
| |
The <xsl:sort> element is used to define a sort key
which specifies the order in which nodes selected by either
<xsl:apply-templates> or <xsl:for-each>
are processed. The nodes can be sorted either in numerical or alphabetic
order, and the alphabetic order may vary depeinding on the language in use.
The nodes can be sorted either in ascending or descending order.
|
| |
Static methods of the Sort class is responsible for generating the
necessary code for invoking SortingIterators under
<xsl:apply-templates> and <xsl:for-each>
elements. Both these elements can have several <xsl:sort>
child nodes defining primary, secondary, teriary, etc. keys. The code for
<xsl:apply-templates> and <xsl:for-each>
create vectors containg a Sort object for each sort key. The object methods
of the Sort object encapsulate a container for key-specific data (such as the
sort key itself, sort order, sort type, and such) while the static methods
take a vector of Sort objects and generate the actual code.
The translate() method of the Sort object is never called. The
vectors containing the Sort objects for a <xsl:apply-templates>
or <xsl:for-each> element are instead passed to the static
translateSortIterator() method. This method compiles code that
instanciates a SortingIterator object that will pass on a node-set in a
specific order to the code handling the <xsl:apply-templates>
or <xsl:for-each> element.
|
|
|