xsl:item-type
New in XSLT 4.0. Used to declare a name for an item type.
Category: declaration
Content: none
Permitted parent elements:
xsl:package
; xsl:stylesheet
; xsl:transform
Attributes
|
| A QName used to identify the item type uniquely within the stylesheet package. |
|
| The definition of the item type. |
|
| The visibility of the item type. Saxon only allows the value "private", which means the item type name is available only within the containing package. |
Saxon availability
Available in XSLT 4.0. Requires Saxon-PE or Saxon-EE. Implemented since Saxon 11. Available for all platforms.
Notes on the Saxon implementation
The xsl:item-type declaration is available from Saxon 13 in XSLT
4.0; it is available in Saxon 11 and 12 provided that syntax
extensions are enabled. (It was also available in earlier releases under the
synonym saxon:item-type.)
In the current implementation item type names must be unique within the
stylesheet; import precedences for multiple declarations are not implemented,
and item types are not visible in other stylesheet packages. The
visibility attribute, if present, must have the value
"private".
The syntax for type name references has been revised a couple of times. From
Saxon 13, as in the current 4.0 specifications, a named item type can be
referenced directly by name, for instance as="typename". In Saxon
10, 11 and 12, the syntax for referring to type aliases was
type(typename); while earlier releases used the experimental
syntax ~typename.
For more information, see Named item types.
Details
The xsl:item-type element is always used at the top level of the
stylesheet.
Examples
Declare and use a named item type as a synonym for a record type:
<xsl:item-type name="cx:complex" as="record(r as xs:double, i as xs:double)"/> <xsl:param name="location" select="0.00" as="cx:complex"/> <xsl:variable name="location-real-part" select="$location?r" as="xs:double"/> <xsl:variable name="location-imaginary-part" select="$location?i" as="xs:double"/>