home contribute faq download

FunctX XSLT Functions

functx:sort-case-insensitive

Sorts a sequence of values or nodes regardless of capitalization

Google
Webxsltfunctions.com

Description

The functx:sort-case-insensitive function sorts a sequence of values or nodes without regard to whether they are upper or lower-case. Normally, using most collations, all upper-case letters are sorted before all lower-case letters, so "Z" would come before "a". It returns the items in their original capitalization.

Arguments and Return Type

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

XSLT Function Declaration

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

   <xsl:for-each select="$seq">
     <xsl:sort select="upper-case(string(.))"/>
     <xsl:copy-of select="."/>
   </xsl:for-each>

</xsl:function>

Examples

<xsl:variable name="in-xml" as="item()*">
<in-xml>
  <f>a</f>
  <f>c</f>
  <e>B</e>
</in-xml>
</xsl:variable>
XSLT ExampleResults
functx:sort-case-insensitive(('a','c','B'))
('a', 'B', 'c')
functx:sort-case-insensitive($in-xml/*)
<f>a</f>
<e>B</e>
<f>c</f>

See Also

functx:sortSorts a sequence of values or nodes
functx:sort-as-numericSorts a sequence of numeric values or nodes
functx:sort-document-orderSorts a sequence of nodes in document order

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