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
selectAn XPath expression that defines the items to be sorted. If the
selectattribute is present, the<xsl:perform-sort>element can only contain<xsl:sort>and<xsl:fallback>elements. In other words, with aselectattribute, the<xsl:perform-sort>element is not allowed to construct a sequence of items because theselectattribute 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 ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access