Name

[2.0] default-collation()

Returns a string that represents the default collation.

Syntax

xs:string default-collation()

Inputs

None.

Output

An xs:string that represents the default collation.

Defined in

XQuery 1.0 and XPath 2.0 Functions and Operators section 16, “Context Functions.”

Example

Here’s a stylesheet that simply displays the default collation:

<?xml version="1.0"?>
<!-- default-collation.xsl -->
<xsl:stylesheet version="2.0"
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

  <xsl:output method="text"/>

  <xsl:template match="/">
    <xsl:text>&#xA;The default collation is: &#xA;  </xsl:text>
    <xsl:value-of select="default-collation()"/>
  </xsl:template>

</xsl:stylesheet>

The results are:

The default collation is:
  http://www.w3.org/2005/xpath-functions/collation/codepoint

The default collation, as defined in the XQuery 1.0 and XPath 2.0 Functions and Operators spec, is the Unicode code point collation. That collation is associated with the URI http://www.w3.org/2005/xpath-functions/collation/codepoint, and all implementations of XPath 2.0 and XQuery 1.0 are required to support it. Implementors are free to support other collation schemes, and each processor can define its own mechanisms for associating a URI with a particular collation. Each processor can define its own default collation as well.

A final note: the default collation can be overridden in functions that specify a collation sequence, such as compare(), deep-equal(), ends-with(), or max().

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.