Name

xsl:element

Synopsis

<xsl:element 
  name               = "QualifiedName"
  namespace          = "URI"
  use-attribute-sets = "QualifiedName1 QualifiedName2...">  
 <! --  template  -- >
</xsl:element>

The xsl:element instruction inserts an element into the result tree. The element’s name is given by the name attribute. The element’s namespace URI, if any, is given by the optional namespace attribute. Attributes can be added via xsl:attribute children or by referencing an xsl:attribute-set declared elsewhere in the stylesheet from the use-attribute-sets attribute. Finally, the element’s contents are determined by instantiating the template contained in the xsl:element element’s content.

Attributes

name, required, attribute value template

The name of the element this instruction creates.

namespace, optional, attribute value template

The namespace URI of the element this instruction creates. If this attribute is omitted, then the namespace is determined by matching the name’s prefix (or lack thereof) to the namespace declarations in scope at this point in the stylesheet.

use-attribute-sets, optional

A whitespace-separated list of names of xsl:attribute-set elements declared as top-level elements elsewhere in the stylesheet. These attribute sets are merged, and all attributes in the merged set are added to the element.

Contents

The contents of this element are a template. Once instantiated, this template forms the content of the element inserted into the result tree.

Get XML in a Nutshell, 3rd 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.