Name

<xsl:element>

Allows you to create an element in the output document. It works similarly to the <xsl:attribute> element.

Category

Instruction.

Required Attribute

name

Defines the name of this element. A value of name="Fred" produces a <Fred> element in the output document.

Optional Attributes

namespace

Defines the namespace used for this element.

use-attribute-sets

Lists one or more attribute sets that should be used by this element. If you specify more than one attribute set, separate their names with whitespace characters.

[2.0] inherit-namespaces

Defines whether this element and its children inherit the current namespace nodes. Valid values are yes (the default) and no.

[2.0 – Schema] type

Defines the datatype of this element. The datatype can be any of the built-in datatypes or it can be a datatype defined in a schema if you have a schema-aware XSLT 2.0 processor.

The type and validation attributes are mutually exclusive.

[2.0 – Schema] validation

Defines how the value of the new element will be validated. The validation attribute has four values: strict, lax, preserve, or strip.

validation="strict" means that the XSLT processor looks in all the declared schemas for an element declaration (<xs:element>) with the same name as this element. If the processor can’t find a matching <xs:element>, it is a fatal error. Assuming the processor finds the declaration of the element, it validates the generated element’s value against its declaration.

validation="lax" works just like validation="strict" ...

Get XSLT, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.