XPath/XQuery codepoint-equal function

Summary

Returns true if two strings are equal, considered codepoint-by-codepoint.

Signature

fn:codepoint-equal(
$comparand1 as xs:string?,
$comparand2 as xs:string?
) as xs:boolean?

Properties

This function is deterministic, context-independent, and focus-independent.

Rules

If either argument is the empty sequence, the function returns the empty sequence.

Otherwise, the function returns true or false depending on whether the value of $comparand1 is equal to the value of $comparand2, according to the Unicode codepoint collation (http://www.w3.org/2005/xpath-functions/collation/codepoint).

Examples

The expression fn:codepoint-equal("abcd", "abcd") returns true().

The expression fn:codepoint-equal("abcd", "abcd ") returns false().

The expression fn:codepoint-equal("", "") returns true().

The expression fn:codepoint-equal("", ()) returns ().

The expression fn:codepoint-equal((), ()) returns ().

Notes

This function allows xs:anyURI values to be compared without having to specify the Unicode codepoint collation.