home contribute faq download

FunctX XSLT Functions

functx:sort-document-order

Sorts a sequence of nodes in document order

Google
Webxsltfunctions.com

Description

The functx:sort-document-order function sorts a sequence of nodes in document order. This can be done with a simple path expression, but the function is useful for making the purpose of the expression clear.

Arguments and Return Type

NameTypeDescription
$seq node()* the sequence to sort
return value node()*

XSLT Function Declaration

See XQuery definition.
XSLT 2.0 Syntax:
<xsl:function name="functx:sort-document-order" as="node()*"
              xmlns:functx="http://www.functx.com" >
  <xsl:param name="seq" as="node()*"/>

  <xsl:sequence select="
   $seq/.
 "/>

</xsl:function>

Examples

<xsl:variable name="in-xml" as="item()*">
<in-xml>
   <a>123</a>
   <b>456</b>
   <c>789</c>
</in-xml>
</xsl:variable>
XSLT ExampleResults
functx:sort-document-order(
   ($in-xml/c,$in-xml/a))
<a>123</a>
<c>789</c>

See Also

functx:sortSorts a sequence of values or nodes
functx:sort-as-numericSorts a sequence of numeric values or nodes
functx:sort-case-insensitiveSorts a sequence of values or nodes regardless of capitalization

History

Published OnLast UpdatedContributor(s)
2006-06-272007-02-26Priscilla Walmsley, Datypic, pwalmsley@datypic.com, http://www.datypic.com
Need XSLT Help?
D A T Y P I C
Training | Consulting | Development

XQuery by Priscilla WalmsleyGet the book!
XQuery by Priscilla Walmsley