<?xml version="1.0" encoding="iso-8859-1"?> <?xml-stylesheet href="../make-menu.xsl" type="text/xsl"?><html> <head> <this-is section="xsl-elements" page="perform-sort" subpage=""/> <!-- Generated at 2011-12-09T20:47:22.916Z--><title>Saxonica: XSLT and XQuery Processing: xsl:perform-sort</title> <meta name="coverage" content="Worldwide"/> <meta name="copyright" content="Copyright Saxonica Ltd"/> <meta name="title" content="Saxonica: XSLT and XQuery Processing: xsl:perform-sort"/> <meta name="robots" content="noindex,nofollow"/> <link rel="stylesheet" href="../saxondocs.css" type="text/css"/> </head> <body class="main"> <h1>xsl:perform-sort</h1> <p>The <code>xsl:perform-sort</code> instruction takes a sequence as its input and produces a sorted sequence as its output.</p> <p>The input sequence may be specified either using the <code>select</code> attribute, or using the instructions contained within the <code>xsl:perform-sort</code> instruction.</p> <p>The sort criteria are specified using <code>xsl:sort</code> elements as children of <code>xsl:perform-sort</code>, in the usual way.</p> <p>For example:</p> <div class="codeblock" style="border: solid thin; background-color: #B1CCC7; padding: 2px"> <pre> <code><xsl:perform-sort select="//BOOK"> <xsl:sort select="author/last-name"/> <xsl:sort select="author/first-name"/> </xsl:perform-sort></code> </pre> </div> <p>It's often useful to use <code>xsl:perform-sort</code> inside a stylesheet function; the function can return the sorted sequence as its result, and can be invoked directly from an XPath expression.</p> <table width="100%"> <tr> <td> <p align="right"><a class="nav" href="preserve-space.xml">Next</a></p> </td> </tr> </table> </body> </html>