home contribute faq download

FunctX XSLT Functions

Strings

Google
Webxsltfunctions.com

Substrings

fn:substringA substring based on a starting point and optional length
fn:substring-beforeThe substring before the first occurrence of a delimiter
functx:substring-before-if-containsPerforms substring-before, returning the entire string if it does not contain the delimiter
functx:substring-before-lastThe substring before the last occurrence of a delimiter
functx:substring-before-last-matchThe substring after the first text that matches a regex
functx:substring-before-matchThe substring before the last text that matches a regex
fn:substring-afterThe substring after the first occurrence of a delimiter
functx:substring-after-if-containsPerforms substring-after, returning the entire string if it does not contain the delimiter
functx:substring-after-lastThe substring after the last occurrence of a delimiter
functx:substring-after-last-matchThe substring after the last text that matches a regex
functx:substring-after-matchThe substring after the first text that matches a regex

Regular Expressions

fn:matchesWhether a string matches a regular expression
functx:substring-before-matchThe substring before the last text that matches a regex
functx:substring-before-last-matchThe substring after the first text that matches a regex
functx:substring-after-last-matchThe substring after the last text that matches a regex
functx:substring-after-matchThe substring after the first text that matches a regex
functx:index-of-match-firstThe first position of a matching substring
functx:number-of-matchesThe number of regions that match a pattern
fn:regex-groupThe current group

Indexes

functx:index-of-stringThe position(s) of a substring
functx:index-of-string-firstThe first position of a substring
functx:index-of-string-lastThe last position of a substring
functx:index-of-match-firstThe first position of a matching substring

Contains

fn:containsWhether one string contains another
functx:contains-wordWhether one string contains another, as a separate word
functx:contains-case-insensitiveWhether one string contains another, without regard to case
functx:contains-any-ofWhether a string contains any of a sequence of strings
fn:starts-withWhether one string starts with another
fn:ends-withWhether one string ends with another

Concatenating and Splitting

fn:concatConcatenates two or more strings
fn:string-joinConcatenates a sequence of strings using an optional separator
functx:insert-stringInserts a string at a specified position
fn:tokenizeSplits a string based on a regular expression
functx:charsConverts a string to a sequence of characters
functx:linesSplit a string into separate lines
fn:codepoints-to-stringCreates a string from a sequence of Unicode code points
fn:string-to-codepointsCreates a sequence of Unicode code points from a string

Replacing

fn:replaceReplaces parts of a string that match a regular expression
functx:replace-firstReplaces the first match of a pattern
functx:replace-beginningReplaces the beginning of a string, up to a matched pattern
functx:replace-multiPerforms multiple replacements, using pairs of replace parameters
functx:escape-for-regexEscapes regex special characters
functx:reverse-stringReverses the order of characters
fn:translateReplaces individual characters

Comparing

fn:compareCompares two strings
functx:max-stringThe maximum of a sequence of values, treating them like strings
functx:min-stringThe minimum of a sequence of values, treating them like strings
functx:min-non-empty-stringThe minimum of a sequence of strings, ignoring "empty" values
fn:codepoint-equalWhether two strings have the same Unicode code points

Trimming and Padding

fn:normalize-spaceNormalizes whitespace
functx:trimTrims leading and trailing whitespace
functx:left-trimTrims leading whitespace
functx:right-trimTrims trailing whitespace
functx:pad-string-to-lengthPads a string to a desired length
functx:repeat-stringRepeats a string a given number of times

Capitalization

fn:lower-caseConverts to lower case
fn:upper-caseConverts to upper case
functx:capitalize-firstCapitalizes the first character of a string
functx:camel-case-to-wordsTurns a camelCase string into space-separated words
functx:words-to-camel-caseTurns a string of words into camelCase
functx:format-as-title-enMoves title words like "the" and "a" to the end of strings

Statistics

fn:string-lengthThe length of a string
functx:line-countThe number of lines
functx:max-line-lengthThe maximum line length
functx:word-countThe number of words

Internationalization

fn:default-collationThe default collation
fn:langTests the language of a node
fn:normalize-unicodeNormalizes according to a Unicode normalization form

Need XSLT Help?
D A T Y P I C
Training | Consulting | Development

XQuery by Priscilla WalmsleyGet the book!
XQuery by Priscilla Walmsley