The functions available for use within an XSLT stylesheet can be classified based firstly, on where the function is defined, and secondly, on where it can be used. Specifically, the set of functions available is slightly different for :
Regular XPath expressions within the stylesheet, for example those appearing in
select
or test
attributes, or between braces in a text value template (R)
XPath expressions evaluated dynamically using xsl:evaluate
(D)
The categories are listed in the following table:
Category | Defined where? | Available where? | Notes |
---|---|---|---|
User-defined functions | Defined using xsl:function declarations in the stylesheet
|
R, D | Functions are private by default; private functions can be referenced only
within the package where they are declared (and not in xsl:evaluate
expressions).
|
Constructor functions for built-in types | Section 17 Constructor functions FO30 | R, S, D | These functions are all in the namespace conventionally associated with the
prefix xs . The semantics of a constructor function are identical
to the semantics of a cast expression.
|
Constructor functions for user-defined types | Section 17 Constructor functions FO30 | R, D (if schema-aware="yes" )
|
This category includes a function for every named user-defined simple type in an imported schema; the function allows the conversion of strings and certain other values to instances of the user-defined type. |
Functions defined in XPath 3.0 | [Functions and Operators 3.0] | R, S, D | Includes functions in the namespaces conventionally
referred to be the prefixes fn and math .
|
Additional functions defined in XPath 3.1 (where supported) | [Functions and Operators 3.1] | R, S, D. | This category has an overlap with the set of XSLT-defined-functions. Where a function
is defined both in this document and in XPath 3.1, the function is available in an
XSLT 3.0
stylesheet whether or not the processor supports XPath 3.1. This category includes
functions
in namespaces conventionally referred to by the prefixes fn , map ,
and array .
|
Functions defined in XSLT 3.0 | This specification | R, S (see note), D | See G.2 List of XSLT-defined functions. There is an overlap with
the set of functions defined in XPath 3.1. The functions available in static expressions
are:
element-available , function-available ,
type-available , available-system-properties ,
and system-property .
|
Extension functions | Implementation-defined: see 24.1 Extension Functions. | R, S, D | Availability is implementation-defined |
This appendix acts as an index of functions defined in this specification, to augment the set of functions defined in [Functions and Operators 3.0].
accumulator-after
accumulator-before
available-system-properties
collation-key
copy-of
current
current-group
current-grouping-key
current-merge-group
current-merge-key
current-output-uri
document
element-available
function-available
json-to-xml
key
map:contains
map:entry
map:find
map:for-each
map:get
map:keys
map:merge
map:put
map:remove
map:size
regex-group
snapshot
stream-available
system-property
type-available
unparsed-entity-public-id
unparsed-entity-uri
xml-to-json