Name
[2.0] <xsl:perform-sort>
Sorts a sequence. The sequence to be sorted can be
defined with the select
attribute,
or it can be constructed inside the <xsl:perform-sort>
element
itself.
Category
Instruction
Required Attributes
None.
Optional Attribute
select
An XPath expression that defines the items to be sorted. If the
select
attribute is present, the<xsl:perform-sort>
element can only contain<xsl:sort>
and<xsl:fallback>
elements. In other words, with aselect
attribute, the<xsl:
perform-sort>
element is not allowed to construct a sequence of items because theselect
attribute has already specified one.
Content
<xsl:perform-sort>
contains one or more <xsl:sort>
elements, along with any
number of <xsl:fallback>
elements. If the select
attribute
is not defined, <xsl:perform-sort>
can contain a
sequence constructor. If there is no select
attribute and the <xsl:perform-sort>
element doesn’t
create a sequence, the result is an empty sequence.
Appears in
Any XSLT element whose content model is a sequence constructor or any literal result element.
Defined in
XSLT section 13.2, “Creating a Sorted Sequence.”
Example
We’ll start with an <xsl:perform-sort>
element that uses a
select
attribute to produce a
sorted sequence. Here is our stylesheet:
<?xml version="1.0"?> <!-- perform-sort4.xsl --> <xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xs="http://www.w3.org/2001/XMLSchema"> <xsl:output method="text"/> <xsl:variable name="vendorsInOrder" as="xs:string*"> <xsl:perform-sort ...
Get XSLT, 2nd Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.