The codepoint-equal() function

Smartsite 7.4 - ...

The codepoint-equal() XPath 2.0 function returns true if the two strings are equal, considered codepoint by codepoint.

XML CopyCode image Copy Code
boolean fn:codepoint-equal(arg1, arg2)

Parameters:

  • arg1: a node reference or literal.
  • arg2: a node reference or literal.

Example

XML CopyCode image Copy Code
<html xmlns="http://www.w3.org/1999/xhtml" 
 xmlns:xf="http://www.w3.org/2002/xforms" 
 xmlns:fn="http://www.w3.org/2005/xpath-functions">
 <head>
  <title>Example</title>
  <xf:model>
   <xf:instance>
    <data xmlns="">
     <tekst1>straße</tekst1>
     <tekst2>strasse</tekst2>
     <tekst3>strassen</tekst3>
    </data>
   </xf:instance>
  </xf:model>
 </head>
 <body>
  <xf:group>
   <xf:output value="fn:codepoint-equal(tekst1,tekst2)" />
   <xf:output value="fn:codepoint-equal('strasse','straße')" />
   <xf:output value="fn:codepoint-equal('strassen','straße')" />
   <xf:output value="fn:codepoint-equal('abc','abc')" />
   <xf:output value="fn:codepoint-equal('abc','abc ')" />
  </xf:group>
 </body>
</html>

The result will be:

true
true
false
true
false


Namespace

This function is available within the XPath 2.0 namespace (http://www.w3.org/2005/xpath-functions).