Name
[2.0] codepoint-equal()
Determines whether two strings are equal, based on their Unicode codepoints.
Syntax
xs:boolean?codepoint-equal(
xs:string?
,xs:string?
)
Inputs
Two xs:string
s to be
compared.
Output
This function returns true
or false
depending on whether the two
strings are equal using the Unicode code point collation. This
function allows you to compare xs:anyURI
values without having to
specify a collation. If either argument is the empty sequence, the
result is the empty sequence.
Defined in
XQuery 1.0 and XPath 2.0 Functions and Operators section 7.3, “Equality and Comparison of Strings.”
Example
Here is a short stylesheet that tests strings to see whether they are equal:
<?xml version="1.0"?> <!-- codepoint-equal.xsl --> <xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xs="http://www.w3.org/2001/XMLSchema"> <xsl:output method="text"/> <xsl:template match="/"> <xsl:text>
Tests of the codepoint-equal() function:
</xsl:text> <xsl:text>
 codepoint-equal('A', 'A') = </xsl:text> <xsl:value-of select="codepoint-equal('A', 'A')"/> <xsl:text>
 codepoint-equal('A', '&#x41;') = </xsl:text> <xsl:value-of select="codepoint-equal('A', 'A')"/> <xsl:text>
 codepoint-equal('A', '&#65;') = </xsl:text> <xsl:value-of select="codepoint-equal('A', 'A')"/> <xsl:text>
 codepoint-equal('Strasse', 'Stra&#xDF;e') = </xsl:text> <xsl:value-of select="codepoint-equal('Strasse', 'Straße')"/> </xsl:template> </xsl:stylesheet> ...
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.