fn:unparsed-text-available(xs:string?, xs:string?) as xs:boolean
Determines if an unparsed text resource identified by a URI can be read using the given
encoding
Arguments and return type:
| Type |
Description |
| xs:string? |
The URI identifying the unparsed text resource |
| xs:string? |
The encoding to be used for reading the resource |
| xs:boolean |
Indicates if the resource can be read using the given encoding |
Examples:
| Expression |
Result |
| fn:unparsed-text-available("http://www.example.com/text.txt", "UTF-8") |
Returns true if the text resource identified by the specified URI can be
read using the specified encoding, otherwise false |
W3C Documentation reference: unparsed-text-available
fn:unparsed-text-lines(xs:string?, xs:string?) as xs:string*
Returns the contents of an unparsed text resource identified by a URI, split into
lines
Arguments and return type:
| Type |
Description |
| xs:string? |
The URI identifying the unparsed text resource |
| xs:string? |
The encoding to be used for reading the resource |
| xs:string* |
The lines of the unparsed text resource |
Examples:
| Expression |
Result |
| fn:unparsed-text-lines("http://www.example.com/text.txt", "UTF-8") |
Returns the lines of the text resource identified by the specified URI,
using the specified encoding |
W3C Documentation reference: unparsed-text-lines
fn:unparsed-text(xs:string?, xs:string?) as xs:string?
Returns the contents of an unparsed text resource identified by a URI
Arguments and return type:
| Type |
Description |
| xs:string? |
The URI identifying the unparsed text resource |
| xs:string? |
The encoding to be used for reading the resource |
| xs:string? |
The contents of the unparsed text resource |
Examples:
| Expression |
Result |
| fn:unparsed-text("http://www.example.com/text.txt", "UTF-8") |
Returns the contents of the text resource identified by the specified URI,
using the specified encoding |
W3C Documentation reference: unparsed-text
fn:escape-html-uri(xs:string?) as xs:string
Escapes special characters in a URI to be used in HTML
Arguments and return type:
| Type |
Description |
| xs:string? |
URI to be escaped for use in HTML |
Examples:
| Expression |
Result |
| fn:escape-html-uri('https://example.com/search?q=test&lang=en') |
https://example.com/search?q=test&lang=en |
| fn:escape-html-uri('https://example.com/page?id=1§ion=2') |
https://example.com/page?id=1§ion=2 |
W3C Documentation reference: Escape-HTML-URI
fn:iri-to-uri(xs:string?) as xs:string
Converts an IRI to a URI by escaping non-ASCII characters
Arguments and return type:
| Type |
Description |
| xs:string? |
IRI to be converted to a URI |
Examples:
| Expression |
Result |
| fn:iri-to-uri('https://example.com/ümlaut') |
https://example.com/%C3%BCmlaut |
| fn:iri-to-uri('https://example.com/日本語') |
https://example.com/%E6%97%A5%E6%9C%AC%E8%AA%9E |
W3C Documentation reference: IRI-to-URI
fn:encode-for-uri(xs:string?) as xs:string
Encodes a string for use in a URI by escaping special characters
Arguments and return type:
| Type |
Description |
| xs:string? |
String to be encoded for use in a URI |
Examples:
| Expression |
Result |
| fn:encode-for-uri('hello world') |
hello%20world |
| fn:encode-for-uri('example?query=value¶m=value2') |
example%3Fquery%3Dvalue%26param%3Dvalue2 |
W3C Documentation reference: Encode-for-URI
fn:resolve-uri(xs:string?, xs:string?) as xs:anyURI?
Resolves a relative URI using a base URI
Arguments and return type:
| Type |
Description |
| xs:string? |
Relative URI to resolve |
| xs:string? |
Base URI to use for resolving (optional) |
Examples:
| Expression |
Result |
| fn:resolve-uri('example.html', 'https://www.example.com/folder/') |
https://www.example.com/folder/example.html |
| fn:resolve-uri('../images/pic.jpg',
'https://www.example.com/folder/page.html') |
https://www.example.com/images/pic.jpg |
W3C Documentation reference: Resolve-URI
fn:analyze-string(xs:string?, xs:string, xs:string?) as element(fn:analyze-string-result)
Analyzes the input string and returns an XML fragment containing match and non-match
elements
Arguments and return type:
| Type |
Description |
| xs:string? |
Input string to analyze |
| xs:string |
Regular expression pattern to match |
| xs:string? |
Flags to control the regular expression matching (optional) |
Examples:
| Expression |
Result |
| fn:analyze-string('red,green,blue', ',') |
<fn:analyze-string-result><fn:non-match>red</fn:non-match><fn:match>,
<fn:non-match>green</fn:non-match><fn:match>,
<fn:non-match>blue</fn:non-match></fn:analyze-string-result>
|
W3C Documentation reference: Analyze-String
fn:tokenize(xs:string?, xs:string, xs:string?) as xs:string*
Splits the input string into a sequence of substrings using the pattern as a delimiter
Arguments and return type:
| Type |
Description |
| xs:string? |
Input string to tokenize |
| xs:string |
Regular expression pattern to use as delimiter |
| xs:string? |
Flags to control the regular expression matching (optional) |
Examples:
| Expression |
Result |
| fn:tokenize('XPath 3.0, XQuery 3.0, XSLT 3.0', ',\\s*') |
('XPath 3.0', 'XQuery 3.0', 'XSLT 3.0') |
| fn:tokenize('apple,orange,banana', ',') |
('apple', 'orange', 'banana') |
W3C Documentation reference: Tokenize
fn:replace(xs:string?, xs:string, xs:string, xs:string?) as xs:string
Replaces occurrences of the pattern in the input string with the replacement string
Arguments and return type:
| Type |
Description |
| xs:string? |
Input string to search within |
| xs:string |
Regular expression pattern to match |
| xs:string |
Replacement string |
| xs:string? |
Flags to control the regular expression matching (optional) |
Examples:
| Expression |
Result |
| fn:replace('XPath 3.0 is great', '3.0', '3.1') |
'XPath 3.1 is great' |
| fn:replace('Hello, World!', 'World', 'XPath') |
'Hello, XPath!' |
W3C Documentation reference: Replace
fn:matches(xs:string?, xs:string, xs:string?) as xs:boolean
Returns true if the input string matches the regular expression pattern, otherwise false
Arguments and return type:
| Type |
Description |
| xs:string? |
Input string to search within |
| xs:string |
Regular expression pattern to match |
| xs:string? |
Flags to control the regular expression matching (optional) |
Examples:
| Expression |
Result |
| fn:matches('XPath 3.0', '\\d\\.\\d') |
true |
| fn:matches('Hello, World!', '[A-Z][a-z]*') |
true |
| fn:matches('example123', '\\d+', 'q') |
false |
W3C Documentation reference: Matches
fn:substring-after(xs:string?, xs:string?) as xs:string
Returns the part of the first string that follows the first occurrence of the second
string
Arguments and return type:
| Type |
Description |
| xs:string? |
Input string to search within |
| xs:string? |
Substring to search for |
Examples:
| Expression |
Result |
| fn:substring-after('Hello, World!', ',') |
' World!' |
| fn:substring-after('XPath 3.0 is awesome!', '3.0') |
' is awesome!' |
W3C Documentation reference: Substring-After
fn:substring-before(xs:string?, xs:string?) as xs:string
Returns the part of the first string that precedes the first occurrence of the second
string
Arguments and return type:
| Type |
Description |
| xs:string? |
Input string to search within |
| xs:string? |
Substring to search for |
Examples:
| Expression |
Result |
| fn:substring-before('Hello, World!', ',') |
'Hello' |
| fn:substring-before('XPath 3.0 is awesome!', '3.0') |
'XPath ' |
W3C Documentation reference: Substring-Before
fn:ends-with(xs:string?, xs:string?) as xs:boolean
Returns true if the first string ends with the second string, otherwise false
Arguments and return type:
| Type |
Description |
| xs:string? |
Input string to check |
| xs:string? |
Substring to check for at the end of the first string |
Examples:
| Expression |
Result |
| fn:ends-with('Hello, World!', 'World!') |
true |
| fn:ends-with('Hello, World!', 'Hello') |
false |
| fn:ends-with('XPath 3.0', '3.0') |
true |
W3C Documentation reference: Ends-With
fn:starts-with(xs:string?, xs:string?) as xs:boolean
Returns true if the first string starts with the second string, otherwise false
Arguments and return type:
| Type |
Description |
| xs:string? |
Input string to check |
| xs:string? |
Substring to check for at the beginning of the first string |
Examples:
| Expression |
Result |
| fn:starts-with('Hello, World!', 'Hello') |
true |
| fn:starts-with('Hello, World!', 'World') |
false |
| fn:starts-with('XPath 3.0', 'XPath') |
true |
W3C Documentation reference: Starts-With
fn:contains(xs:string?, xs:string?) as xs:boolean
Returns true if the first string contains the second string, otherwise false
Arguments and return type:
| Type |
Description |
| xs:string? |
Input string to search within |
| xs:string? |
Substring to search for |
Examples:
| Expression |
Result |
| fn:contains('Hello, World!', 'World') |
true |
| fn:contains('Hello, World!', 'world') |
false |
| fn:contains('XPath 3.0', '3.0') |
true |
W3C Documentation reference: Contains
fn:translate(xs:string?, xs:string, xs:string) as xs:string
Returns the input string with specified characters replaced
Arguments and return type:
| Type |
Description |
| xs:string? |
Input string to be translated |
| xs:string |
Map string with characters to replace |
| xs:string |
Translate string with replacement characters |
Examples:
| Expression |
Result |
| fn:translate('apple', 'aeiou', '12345') |
'1ppl2' |
| fn:translate('Hello, World!', 'HW', 'hw') |
'hello, world!' |
W3C Documentation reference: Translate
fn:lower-case(xs:string?) as xs:string
Returns the input string with all characters converted to lowercase
Arguments and return type:
| Type |
Description |
| xs:string? |
Input string to convert to lowercase |
Examples:
| Expression |
Result |
| fn:lower-case('HELLO, WORLD!') |
'hello, world!' |
| fn:lower-case('XPath 3.0') |
'xpath 3.0' |
| fn:lower-case('BANANA') |
'banana' |
W3C Documentation reference: Lower-Case
fn:upper-case(xs:string?) as xs:string
Returns the input string with all characters converted to uppercase
Arguments and return type:
| Type |
Description |
| xs:string? |
Input string to convert to uppercase |
Examples:
| Expression |
Result |
| fn:upper-case('Hello, World!') |
'HELLO, WORLD!' |
| fn:upper-case('XPath 3.0') |
'XPATH 3.0' |
| fn:upper-case('banana') |
'BANANA' |
W3C Documentation reference: Upper-Case
fn:normalize-unicode(xs:string?, xs:string) as xs:string
Returns the input string with Unicode normalization applied
Arguments and return type:
| Type |
Description |
| xs:string? |
Input string to normalize |
| xs:string |
Normalization form to apply (NFC, NFD, NFKC, NFKD) |
Examples:
| Expression |
Result |
| fn:normalize-unicode('Café', 'NFC') |
'Café' |
| fn:normalize-unicode('Café', 'NFD') |
'Café' |
W3C Documentation reference: Normalize-Unicode
fn:normalize-space(xs:string?) as xs:string
Returns the input string with whitespace normalized
Arguments and return type:
| Type |
Description |
| xs:string? |
Input string to normalize whitespace |
Examples:
| Expression |
Result |
| fn:normalize-space(' Hello, World! ') |
'Hello, World!' |
| fn:normalize-space(' XPath 3.0 ') |
'XPath 3.0' |
| fn:normalize-space('\tbanana\t') |
'banana' |
W3C Documentation reference: Normalize-Space
fn:string-length(xs:string?) as xs:integer
Returns the length of the input string
Arguments and return type:
| Type |
Description |
| xs:string? |
Input string to calculate length |
Examples:
| Expression |
Result |
| fn:string-length('Hello, World!') |
13 |
| fn:string-length('XPath 3.0') |
8 |
| fn:string-length('banana') |
6 |
W3C Documentation reference: String-Length
fn:substring(xs:string?, xs:double) as xs:string
Returns a substring of the source string, starting from a specific location
Arguments and return type:
| Type |
Description |
| xs:string? |
Input source string |
| xs:double |
Starting location to extract the substring |
Examples:
| Expression |
Result |
| fn:substring('Hello, World!', 1, 5) |
'Hello' |
| fn:substring('XPath 3.0', 7) |
'3.0' |
| fn:substring('banana', 2, 3) |
'ana' |
W3C Documentation reference: Substring
fn:string-join(xs:string*, xs:string) as xs:string
Joins a sequence of strings with a specified separator, returning a single string
Arguments and return type:
| Type |
Description |
| xs:string* |
Input sequence of strings to join |
| xs:string |
Separator string to insert between joined strings |
Examples:
| Expression |
Result |
| fn:string-join(('apple', 'banana', 'orange'), ', ') |
'apple, banana, orange' |
| fn:string-join(('XPath', '3.0', 'Functions'), ' - ') |
'XPath - 3.0 - Functions' |
| fn:string-join(('A', 'B', 'C'), '') |
'ABC' |
W3C Documentation reference: String-Join
fn:concat(xs:anyAtomicType?, xs:anyAtomicType?, ...) as xs:string
Concatenates two or more strings or atomic values, returning a single string
Arguments and return type:
| Type |
Description |
| xs:anyAtomicType? |
Input strings or atomic values to concatenate |
Examples:
| Expression |
Result |
| fn:concat('Hello', ' ', 'World') |
'Hello World' |
| fn:concat('I have ', 3, ' apples') |
'I have 3 apples' |
| fn:concat('XPath ', '3.0') |
'XPath 3.0' |
W3C Documentation reference: Concat
fn:codepoint-equal(xs:string?, xs:string?) as xs:boolean?
Compares two strings on a codepoint-by-codepoint basis and returns true if they are
equal, false otherwise
Arguments and return type:
| Type |
Description |
| xs:string? |
First string to compare |
| xs:string? |
Second string to compare |
Examples:
| Expression |
Result |
| fn:codepoint-equal('Hello', 'Hello') |
true |
| fn:codepoint-equal('Hello', 'hello') |
false |
| fn:codepoint-equal('apple', 'banana') |
false |
W3C Documentation reference: Codepoint-Equal
fn:compare(xs:string?, xs:string?) as xs:integer?
Compares two strings and returns -1, 0, or 1 if the first string is less than, equal to,
or greater than the second string, respectively
Arguments and return type:
| Type |
Description |
| xs:string? |
First string to compare |
| xs:string? |
Second string to compare |
Examples:
| Expression |
Result |
| fn:compare('apple', 'banana') |
-1 |
| fn:compare('apple', 'apple') |
0 |
| fn:compare('banana', 'apple') |
1 |
W3C Documentation reference: Compare
fn:string-to-codepoints(xs:string?) as xs:integer*
Returns a sequence of Unicode code points for a given string
Arguments and return type:
| Type |
Description |
| xs:string? |
Input string |
Examples:
| Expression |
Result |
| fn:string-to-codepoints('Hello') |
(72, 101, 108, 108, 111) |
| fn:string-to-codepoints('( ͡° ͜ʖ ͡°)') |
(40, 32, 865, 176, 32, 860, 662, 32, 865, 176, 41) |
| fn:string-to-codepoints('😊') |
(128522) |
W3C Documentation reference: String-To-Codepoints
fn:codepoints-to-string(xs:integer*) as xs:string
Constructs a string from a sequence of Unicode code points
Arguments and return type:
| Type |
Description |
| xs:integer* |
Sequence of Unicode code points |
Examples:
| Expression |
Result |
| fn:codepoints-to-string((72, 101, 108, 108, 111)) |
Hello |
| codepoints-to-string((40, 32, 865, 176, 32, 860, 662, 32, 865, 176, 41))
|
( ͡° ͜ʖ ͡°) |
| fn:codepoints-to-string((128522)) |
😊 |
W3C Documentation reference: Codepoints-To-String
fn:string(object)
Returns the string representation of the object argument
Arguments and return type:
| Type |
Description |
| string |
The object to convert to a string |
Examples:
| Expression |
Result |
| string((1<0)) |
false |
| string(.11) |
0.11 |
W3C Documentation reference: String-Functions