xsl:element Element

Creates an element with the specified name in the output.

<xsl:element
  name = "element-name"  
  namespace = "uri-reference"
  use-attribute-sets = Qname
</xsl:element>

Attributes

  • name
    [required] Name of the element to create. If this value is a QName, the element node is created in the name space currently bound to the prefix unless otherwise overridden by the presence of a namespace attribute. The value of the name attribute is interpreted as an attribute value template (expressions in curly braces are evaluated and converted to strings as in <xsl:value-of>). This allows the name of the element to be calculated or obtained from the source XML.
  • namespace
    The name space URI of the created element. If the name element contains a QName, the prefix specified there will be bound to the name space specified in the name space attribute, possibly resulting in the addition of additional name space declarations when serializing. This value is interpreted as an attribute value template.
  • use-attribute-sets
    A white space-separated list of attribute sets specified as a qualified name. Specifying a use-attribute-sets attribute is equivalent to adding <xsl:attribute> elements for each of the attributes in each of the named attribute sets to the beginning of the content of the element with the use-attribute-sets attribute, in the same order in which the names of the attribute sets are specified in the use-attribute-sets attribute. It is an error if use of use-attribute-sets attributes on <xsl:attribute-set> elements causes an attribute set to directly or indirectly use itself.

Element Information

Number of occurrences Unlimited
Parent elements xsl:copy, xsl:element, xsl:for-each, xsl:if, xsl:otherwise, xsl:param, xsl:template, xsl:variable, xsl:when, xsl:with-param, output elements
Child elements xsl:apply-templates, xsl:attribute, xsl:call-template, xsl:choose, xsl:comment, xsl:copy, xsl:copy-of, xsl:element, xsl:for-each, xsl:if, xsl:processing-instruction, xsl:text, xsl:value-of, xsl:variable, output elements

Remarks

The <xsl:element> element allows an element to be created with a computed name. The name of the element to be created is specified by a required name attribute and an optional namespace attribute. The content of the <xsl:element> element is a template for the attributes and children of the created element.

This element provides an escaping mechanism for creating elements with name space clashes, such as XSLT itself.

See Also

XSLT Elements

 Last updated on Saturday, April 10, 2004

© 1992-2003 Microsoft Corporation. All rights reserved.