Name

<xsl:element>

Synopsis

<xsl:element name= name|URI#name > ... </xsl:element>

Description

Inserts the element pointed to by the attribute name into the result document. For example:

<xsl:element name="book">
  <xsl:element name="chapter">
    <xsl:text>The Opening of Pandora's Box</xsl:text>
  </xsl:element>
</xsl:element>

This creates the following in the result node:

<book>
  <chapter>The Opening of Pandora's Box</chapter>
</book>

Elements without explicit namespaces use the default namespace of their current context. Also, you can create a namespace for the element yourself:

<xsl:element name="http://www.oreilly.com/#book">

This employs the namespace associated with the URI http://www.oreilly.com with the element. If no namespaces are associated with the URI, it becomes the default namespace.

Get XML Pocket Reference 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.