home contribute faq download

FunctX XSLT Functions

Below is an alphabetical list of all available functions. You can also see a list of functions by category.

FunctX XSLT Function Library

functx:add-attributesAdds attributes to XML elements
functx:add-monthsAdds months to a date
functx:add-or-update-attributesAdds attributes to XML elements
functx:all-whitespaceWhether a value is all whitespace or a zero-length string
functx:are-distinct-valuesWhether all the values in a sequence are distinct
functx:atomic-typeThe built-in type of an atomic value
functx:avg-empty-is-zeroThe average, counting "empty" values as zero
functx:between-exclusiveWhether a value is between two provided values
functx:between-inclusiveWhether a value is between two provided values, or equal to one of them
functx:camel-case-to-wordsTurns a camelCase string into space-separated words
functx:capitalize-firstCapitalizes the first character of a string
functx:change-element-names-deepChanges the names of elements in an XML fragment
functx:change-element-ns-deepChanges the namespace of XML elements and its descendants
functx:change-element-nsChanges the namespace of XML elements
functx:charsConverts a string to a sequence of characters
functx:contains-any-ofWhether a string contains any of a sequence of strings
functx:contains-case-insensitiveWhether one string contains another, without regard to case
functx:contains-wordWhether one string contains another, as a separate word
functx:copy-attributesCopies attributes from one element to another
functx:dateConstruct a date from a year, month and day
functx:dateTimeConstruct a date/time from individual components
functx:day-in-yearThe day of the year (a number between 1 and 366)
functx:day-of-week-abbrev-enThe abbreviated day of the week, from a date, in English
functx:day-of-week-name-enThe name of the day of the week, from a date, in English
functx:day-of-weekThe day of the week, from a date
functx:dayTimeDurationConstruct a dayTimeDuration from a number of days, hours, etc.
functx:days-in-monthNumber of days in the month
functx:depth-of-nodeThe depth (level) of a node in an XML tree
functx:distinct-attribute-namesThe distinct names of all attributes in an XML fragment
functx:distinct-deepThe XML nodes with distinct values, taking into account attributes and descendants
functx:distinct-element-namesThe distinct names of all elements in an XML fragment
functx:distinct-element-pathsThe distinct paths of all descendant elements in an XML fragment
functx:distinct-nodesThe distinct XML nodes in a sequence (by node identity)
functx:duration-from-timezoneConverts a timezone like "-05:00" or "Z" into xs:dayTimeDuration
functx:dynamic-pathDynamically evaluates a simple XPath path
functx:escape-for-regexEscapes regex special characters
functx:exclusive-orWhether one (and only one) of two boolean values is true
functx:first-day-of-monthThe first day of the month of a date
functx:first-day-of-yearThe first day of the year of a date
functx:first-nodeThe XML node in a sequence that appears first in document order
functx:follows-not-descendantWhether an XML node follows another without being its descendant
functx:format-as-title-enMoves title words like "the" and "a" to the end of strings
functx:fragment-from-uriReturns the fragment from a URI
functx:has-element-only-contentWhether an element has element-only content
functx:has-empty-contentWhether an element has empty content
functx:has-mixed-contentWhether an element has mixed content
functx:has-simple-contentWhether an element has simple content
functx:id-from-elementGets the ID of an XML element
functx:id-untypedGets XML element(s) that have an attribute with a particular value
functx:if-absentThe first argument if it is not empty, otherwise the second argument
functx:if-emptyThe first argument if it is not blank, otherwise the second argument
functx:index-of-deep-equal-nodeThe position of a node in a sequence, based on contents and attributes
functx:index-of-match-firstThe first position of a matching substring
functx:index-of-nodeThe position of a node in a sequence, based on node identity
functx:index-of-string-firstThe first position of a substring
functx:index-of-string-lastThe last position of a substring
functx:index-of-stringThe position(s) of a substring
functx:insert-stringInserts a string at a specified position
functx:is-a-numberWhether a value is numeric
functx:is-absolute-uriWhether a URI is absolute
functx:is-ancestorWhether an XML node is an ancestor of another node
functx:is-descendantWhether an XML node is a descendant of another node
functx:is-leap-yearWhether a date falls in a leap year
functx:is-node-among-descendants-deep-equalWhether an XML node is among the descendants of a sequence, based on contents and attributes
functx:is-node-among-descendantsWhether an XML node is among the descendants of a sequence, based on node identity
functx:is-node-in-sequence-deep-equalWhether an XML node is in a sequence, based on contents and attributes
functx:is-node-in-sequenceWhether an XML node is in a sequence, based on node identity
functx:is-value-in-sequenceWhether an atomic value appears in a sequence
functx:last-day-of-monthThe last day of the month of a date
functx:last-day-of-yearThe last day of the month of a date
functx:last-nodeThe XML node in a sequence that is last in document order
functx:leaf-elementsAll XML elements that don't have any child elements
functx:left-trimTrims leading whitespace
functx:line-countThe number of lines
functx:linesSplit a string into separate lines
functx:max-depthThe maximum depth of elements in an XML tree
functx:max-determine-typeThe maximum value in a sequence, figuring out its type (numeric or string)
functx:max-line-lengthThe maximum line length
functx:max-nodeThe XML node whose typed value is the maximum
functx:max-stringThe maximum of a sequence of values, treating them like strings
functx:min-determine-typeThe minimum value in a sequence, figuring out its type (numeric or string)
functx:min-nodeThe XML node whose typed value is the minimum
functx:min-non-empty-stringThe minimum of a sequence of strings, ignoring "empty" values
functx:min-stringThe minimum of a sequence of values, treating them like strings
functx:mmddyyyy-to-dateConverts a string with format MMDDYYYY (with any delimiters) to a date
functx:month-abbrev-enThe month of a date as an abbreviated word (Jan, Feb, etc.)
functx:month-name-enThe month of a date as a word (January, February, etc.)
functx:name-testWhether a name matches a list of names or name wildcards
functx:namespaces-in-useA list of namespaces used in element/attribute names in an XML fragment
functx:next-dayThe next day
functx:node-kindThe XML node kind (element, attribute, text, etc.)
functx:non-distinct-valuesReturns any values that appear more than once in a sequence
functx:number-of-matchesThe number of regions that match a pattern
functx:open-ref-documentResolves a relative URI and references it, returning an XML document
functx:ordinal-number-enReformats a number as an ordinal number, e.g. 1st, 2nd, 3rd.
functx:pad-integer-to-lengthPads an integer to a desired length by adding leading zeros
functx:pad-string-to-lengthPads a string to a desired length
functx:path-to-node-with-posA unique path to an XML node (or sequence of nodes)
functx:path-to-nodeA path to an XML node (or sequence of nodes)
functx:precedes-not-ancestorWhether an XML node precedes another without being its ancestor
functx:previous-dayThe previous day
functx:remove-attributes-deepRemoves attributes from an XML fragment, based on name
functx:remove-attributesRemoves attributes from an XML element, based on name
functx:remove-elements-deepRemoves descendant elements from an XML node, based on name
functx:remove-elements-not-contentsRemoves descendant XML elements but keeps their content
functx:remove-elementsRemoves child elements from an XML node, based on name
functx:repeat-stringRepeats a string a given number of times
functx:replace-beginningReplaces the beginning of a string, up to a matched pattern
functx:replace-element-valuesUpdates the content of one or more elements
functx:replace-firstReplaces the first match of a pattern
functx:replace-multiPerforms multiple replacements, using pairs of replace parameters
functx:reverse-stringReverses the order of characters
functx:right-trimTrims trailing whitespace
functx:scheme-from-uriReturns the scheme from a URI
functx:sequence-deep-equalWhether two sequences have the same XML node content and/or values
functx:sequence-node-equal-any-orderWhether two sequences contain the same XML nodes, regardless of order
functx:sequence-node-equalWhether two sequences contain the same XML nodes, in the same order
functx:sequence-typeThe sequence type that represents a sequence of nodes or values
functx:siblings-same-nameThe siblings of an XML element that have the same name
functx:siblingsThe siblings of an XML node
functx:sort-as-numericSorts a sequence of numeric values or nodes
functx:sort-case-insensitiveSorts a sequence of values or nodes regardless of capitalization
functx:sort-document-orderSorts a sequence of nodes in document order
functx:sortSorts a sequence of values or nodes
functx:substring-after-if-containsPerforms substring-after, returning the entire string if it does not contain the delimiter
functx:substring-after-last-matchThe substring after the last text that matches a regex
functx:substring-after-lastThe substring after the last occurrence of a delimiter
functx:substring-after-matchThe substring after the first text that matches a regex
functx:substring-before-if-containsPerforms substring-before, returning the entire string if it does not contain the delimiter
functx:substring-before-last-matchThe substring after the first text that matches a regex
functx:substring-before-lastThe substring before the last occurrence of a delimiter
functx:substring-before-matchThe substring before the last text that matches a regex
functx:timeConstruct a time from an hour, minute and second
functx:timezone-from-durationConverts an xs:dayTimeDuration into a timezone like "-05:00" or "Z"
functx:total-days-from-durationThe total number of days in a dayTimeDuration
functx:total-hours-from-durationThe total number of hours in a dayTimeDuration
functx:total-minutes-from-durationThe total number of minutes in a dayTimeDuration
functx:total-months-from-durationThe total number of months in a yearMonthDuration
functx:total-seconds-from-durationThe total number of seconds in a dayTimeDuration
functx:total-years-from-durationThe total number of years in a yearMonthDuration
functx:trimTrims leading and trailing whitespace
functx:update-attributesUpdates the attribute value of an XML element
functx:value-exceptThe values in one sequence that aren't in another sequence
functx:value-intersectThe intersection of two sequences of values
functx:value-unionThe union of two sequences of values
functx:word-countThe number of words
functx:words-to-camel-caseTurns a string of words into camelCase
functx:wrap-values-in-elementsWraps a sequence of atomic values in XML elements
functx:yearMonthDurationConstruct a yearMonthDuration from a number of years and months

Built-In Functions

fn:QNameConstructs a QName from a namespace and local part
fn:absThe absolute value
fn:adjust-date-to-timezoneAdjusts a date to a specific timezone, or no timezone
fn:adjust-dateTime-to-timezoneAdjusts a dateTime to a specific timezone, or no timezone
fn:adjust-time-to-timezoneAdjusts a time to a specific timezone, or no timezone
fn:avgThe average of a sequence of values
fn:base-uriThe base URI of a node
fn:booleanThe effective boolean value of a sequence
fn:ceilingRounds up to the next highest integer
fn:codepoint-equalWhether two strings have the same Unicode code points
fn:codepoints-to-stringCreates a string from a sequence of Unicode code points
fn:collectionOpens a collection
fn:compareCompares two strings
fn:concatConcatenates two or more strings
fn:containsWhether one string contains another
fn:countThe number of items in a sequence
fn:current-dateThe current date
fn:current-dateTimeThe current date/time
fn:current-groupThe current group
fn:current-grouping-keyThe current grouping key
fn:current-timeThe current time
fn:currentReturn the current item
fn:dataThe atomic value of a node
fn:dateTimeConstruct a dateTime from a date and time
fn:day-from-dateThe day portion of a date
fn:day-from-dateTimeThe day portion of a date/time
fn:days-from-durationThe number of days in a duration
fn:deep-equalWhether two nodes have the same content and attributes
fn:default-collationThe default collation
fn:distinct-valuesThe distinct atomic values in a sequence
fn:doc-availableWhether a document is available
fn:docOpens a document based on a URI
fn:document-uriThe URI of a document
fn:documentOpen one or more XML documents
fn:element-availableWhether a XSLT instruction is supported
fn:emptyWhether a value is the empty sequence
fn:encode-for-uriEncodes reserved characters for use in the path of a URI
fn:ends-withWhether one string ends with another
fn:errorRaises a custom error
fn:escape-html-uriEscapes all characters except printable ASCII characters
fn:exactly-oneReturns a sequence if it contains exactly one item, otherwise errors
fn:existsWhether an argument is the empty sequence
fn:falseThe boolean value false
fn:floorRounds down to the next lowest integer
fn:format-dateFormat a date
fn:format-dateTimeFormat a date/time
fn:format-numberFormat a number
fn:format-timeFormat a time
fn:function-availableWhether a function is supported
fn:generate-idGenerate an unique ID for a node
fn:hours-from-dateTimeThe hour portion of a date/time
fn:hours-from-durationThe hours in a duration
fn:hours-from-timeThe hour portion of a time
fn:idRetrieves elements by their ID
fn:idrefRetrieves elements that refer to other elements based on ID
fn:implicit-timezoneThe implicit timezone set by the processor
fn:in-scope-prefixesThe prefixes that are in scope for an element
fn:index-ofThe position(s) of an atomic value within a sequence
fn:insert-beforeInserts a new item into a sequence
fn:iri-to-uriConverts an IRI into a URI
fn:keyReturn the nodes that have a specified key
fn:langTests the language of a node
fn:lastThe size of the current context
fn:local-name-from-QNameThe local part of a QName
fn:local-nameThe local part of a node's name
fn:lower-caseConverts to lower case
fn:matchesWhether a string matches a regular expression
fn:maxThe maximum of a sequence of values
fn:minThe minimum of a sequence of values
fn:minutes-from-dateTimeThe minute portion of a date/time
fn:minutes-from-durationThe number of minutes in a duration
fn:minutes-from-timeThe minute portion of a time
fn:month-from-dateThe month portion of a date
fn:month-from-dateTimeThe month portion of a date/time
fn:months-from-durationThe number of months in a duration
fn:nameThe qualified name of a node, as a string
fn:namespace-uri-for-prefixThe namespace associated with a prefix, in the scope of an element
fn:namespace-uri-from-QNameThe namespace part of a QName
fn:namespace-uriThe namespace URI of a node
fn:nilledWhether an element is nilled (has xsi:nil="true")
fn:node-nameThe qualified name of a node, as a QName
fn:normalize-spaceNormalizes whitespace
fn:normalize-unicodeNormalizes according to a Unicode normalization form
fn:notNegates a boolean value
fn:numberConverts a value or a node to a number
fn:one-or-moreReturns a sequence if it contains one or more items, otherwise errors
fn:positionThe current context position
fn:prefix-from-QNameThe prefix portion of a QName
fn:regex-groupThe current group
fn:removeRemoves an item from a sequence
fn:replaceReplaces parts of a string that match a regular expression
fn:resolve-QNameResolves a QName based on the in-scope namespaces of an element
fn:resolve-uriResolves a relative URI to a base URI, returning an absolute URI
fn:reverseReverses the order of a sequence
fn:rootThe root of the tree that contains the argument
fn:round-half-to-evenRounds a numeric value, rounding even halfs to the nearest even number
fn:roundRounds a numeric value
fn:seconds-from-dateTimeThe seconds portion of a date/time
fn:seconds-from-durationThe number of seconds in a duration
fn:seconds-from-timeThe seconds portion of a time
fn:starts-withWhether one string starts with another
fn:static-base-uriThe base URI from the static context
fn:string-joinConcatenates a sequence of strings using an optional separator
fn:string-lengthThe length of a string
fn:string-to-codepointsCreates a sequence of Unicode code points from a string
fn:stringConverts a value or a node to string
fn:subsequenceA portion of a sequence based on a starting point and length
fn:substring-afterThe substring after the first occurrence of a delimiter
fn:substring-beforeThe substring before the first occurrence of a delimiter
fn:substringA substring based on a starting point and optional length
fn:sumThe sum of values in a sequence
fn:system-propertyReturn a system property
fn:timezone-from-dateThe timezone portion of a date
fn:timezone-from-dateTimeThe timezone portion of a date/time
fn:timezone-from-timeThe timezone portion of a time
fn:tokenizeSplits a string based on a regular expression
fn:traceReports tracing information in an implementation-defined way
fn:translateReplaces individual characters
fn:trueThe boolean value true
fn:type-availableWhether a schema type is available
fn:unorderedIndicates that order is not significant, to improve performance
fn:unparsed-entity-public-idThe public identifier of an unparsed entity
fn:unparsed-entity-uriThe URI of an unparsed entity
fn:unparsed-text-availableCheck if a non-XML document exists
fn:unparsed-textOpen a non-XML document
fn:upper-caseConverts to upper case
fn:year-from-dateThe year portion of a date
fn:year-from-dateTimeThe year portion of a date/time
fn:years-from-durationThe number of years in a duration
fn:zero-or-oneReturns a sequence if it contains zero or one items, otherwise errors
Need XSLT Help?
Training | Consulting | Development

XQuery by Priscilla WalmsleyGet the book!
XQuery by Priscilla Walmsley