Returns the part of $arg1 that precedes the first occurrence of
$arg2, taking collations into account.
fn:substring-before( $arg1 as xs:string?,$arg2 as xs:string?xs:stringfn:substring-before( $arg1 as xs:string?,$arg2 as xs:string?,$collation as xs:stringxs:string If the value of $arg1 or $arg2 is the empty sequence, or
contains only ignorable collation units, it is interpreted as the zero-length
string.
If the value of $arg2 is the zero-length string, then the function returns
the zero-length string.
If the value of $arg1 does not contain a string that is equal to the value
of $arg2, then the function returns the zero-length string.
The collation used by this function is determined according to the rules in .
The function returns the substring of the value of $arg1 that precedes in
the value of $arg1 the first occurrence of a sequence of collation units
that provides a minimal match to the collation units of $arg2
according to the collation that is used.
Minimal match is defined in .
The collation used in these examples, http://example.com/CollationA is a
collation in which both "-" and "*" are ignorable collation units.
"Ignorable collation unit" is equivalent to "ignorable collation element" in .
The expression fn:substring-before ( "tattoo", "attoo") returns "t".
The expression fn:substring-before ( "tattoo", "tatto") returns "".
The expression fn:substring-before ((), ()) returns "".
The expression fn:substring-before ( "abcdefghi", "--d-e-",
"http://www.w3.org/2013/collation/UCA?lang=en;alternate=blanked;strength=primary") returns "abc".
The expression fn:substring-before ( "abc--d-e-fghi", "--d-e-",
"http://www.w3.org/2013/collation/UCA?lang=en;alternate=blanked;strength=primary") returns "abc--".
The expression fn:substring-before ( "a*b*c*d*e*f*g*h*i*", "***cde",
"http://www.w3.org/2013/collation/UCA?lang=en;alternate=blanked;strength=primary") returns "a*b*".
The expression fn:substring-before ( "Eureka!", "--***-*---",
"http://www.w3.org/2013/collation/UCA?lang=en;alternate=blanked;strength=primary") returns "".
A dynamic error may be raised if the specified collation does not support collation units.