xsl:item-type

Experimental: proposed new XSLT 4.0 declaration. Used to declare a name (or alias) for an item type.

Category: declaration
Content: none
Permitted parent elements: xsl:package ; xsl:stylesheet ; xsl:transform

Attributes

name

eqname

A QName used to identify the item type uniquely within the stylesheet package.

as

item-type

The definition of the item type.

visibility?

"private" | "final"

The visibility of the item type. Saxon 11 only allows the value "private", which means the item type name is available only within the containing package.

Saxon availability

Available in the XSLT 4.0 proposal. Requires Saxon-PE or Saxon-EE. Implemented experimentally since Saxon 11. Available for all platforms.

Notes on the Saxon implementation

Available from Saxon 11; requires syntax extensions to be enabled. 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".

Saxon 11 requires the type name to be referenced in the form as="type(typename)", whereas the current XPath 4.0 proposal suggests allowing the simpler as="typename" (which requires type alias names to be distinct from the names of atomic and union types).

For more information, see The xsl:item-type declaration and Type aliases.

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="complex" as="record(r as xs:double, i as xs:double)"/> <xsl:param name="location" select="0.00" as="type(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"/>

Links to W3C specifications

XSLT 4.0 Specification