EXSLT Strings module
The supported extension functions that are included in the EXSLT Strings module.
The following table lists the supported functions in the EXSLT Strings module.
xmlns:str="http://exslt.org/strings"
| Name | Element or function | Supported |
|---|---|---|
| str:align() | Function | Yes |
| str:concat() | Function | Yes |
| str:decode-uri() | Function | Yes |
| str:encode-uri() | Function | Yes |
| str:padding() | Function | Yes |
| str:replace() | Function | No |
| str:split() | Function | Yes |
| str:tokenize() | Function | Yes |
str:align()
The str:align() extension aligns the first string within the second string and
returns the resulting string. The third string specifies how the alignment is to be done. Valid
values for the third string are left, right, or
center.
- Syntax
- str:align(string, string, string)
str:concat()
The str:concat() extension returns the concatenation of the string values of all nodes in a target node set.
- Syntax
- str:concat(nodeset)
str:decode-uri()
The str:decode-uri() extension decodes a URI-encoded string.
- Syntax
- str:decode-uri(URI, encoding)
- Parameters
-
- URI
- Specifies an XPath expression that resolves to a string and specifies the string to escape.
- encoding
- Specifies an XPath expression that resolves to a string and specifies the character encoding of
URI. The default value is UTF-8.
If specified, use an encoding name that IANA maintains. For more information, see IANA Character Sets.
str:encode-uri()
The str:encode-uri() extension returns an encoded URI.
- Syntax
- str:encode-uri(URI, escapeReserved, encoding)
- Parameters
-
- URI
- Specifies an XPath expression that resolves to a string and specifies the string to escape.
- escapeReserved
- Specifies the keyword that indicates the set of characters to escape. Escaping rules are defined
in Section 2 of RFC
2396 as amended by RFC 2732. Input strings typically represent all or part of a URI, URI
reference, or IRI.
true()- Escapes spaces and the following characters:
$ & , / : ; = ? @ " # + % < > [ ] \ ` { } | ~Use
true()to escape a string that is to form a single part of a URI, URI reference, or IRI. false()- Escapes spaces and the following characters:
" # + % < > [ ] \ ` { } | ~In other words, the following reserved characters are not escaped:
$ & , / : ; = ? @ +Use
false()to escape an entire URI, URI reference, or IRI.
- encoding
- Specifies an XPath expression that resolves to a string and specifies the character encoding of
URI. The default value is UTF-8.
If specified, use an encoding name that IANA maintains. For more information, see IANA Character Sets.
- Guidelines
- The effect of the function is to replace any special character in the string by an escape
sequence of the form
%xx%yy, wherexxyyis the hex representation of the octets. The octets represent the characters in ASCII for characters in the ASCII repertoire, and a different character encoding for non-ASCII characters.RFC 2396 does not define whether escaped URIs are use lowercase or uppercase for hexadecimal digits. To make sure that escaped URIs can be compared with string comparison functions, this function must always use the uppercase letters A through F.
If an encoding cannot represent a character, the character is escaped as a question mark (
"%3F").
str:padding()
The str:padding() extension creates a padding string of a specified length.
- Syntax
- str:padding(length, string)
str:split()
The str:split() extension splits up a string and returns a node set of token elements, each containing one token from the string.
- Syntax
- str:split(string, pattern?)
str:tokenize()
The str:tokenize() extension splits up a string and returns a node set of token elements, each containing one token from the string.
- Syntax
- str:tokenize (string, delimiter?)