xsl:attribute Element
Creates an attribute node and attaches it to an output element.
<xsl:attribute
name = "attribute-name"
namespace = "uri-reference">
</xsl:attribute>
Attributes
- name
[required] Name of the attribute to create. If this value is a QName, the attribute 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 attribute to be calculated or obtained from the source XML. - namespace
The name space Uniform Resource Identifier (URI) of the created attribute. If the name attribute 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 other name space declarations when serializing. This value is interpreted as an attribute value template.
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 |
Child elements | xsl:apply-templates, xsl:call-template, xsl:choose, xsl:copy, xsl:copy-of, xsl:for-each, xsl:if, xsl:text, xsl:variable |
Remarks
The contents of this element specify the value of the attribute.
Attributes can be added or modified during transformation by placing the <xsl:attribute> element within elements that generate output, such as the <xsl:copy> element. Note that <xsl:attribute> can be used directly on output elements and not only in conjunction with <xsl:element>.
All attributes must be applied before children are added to the element.
See Also
XSLT Elements | Qualified Names
Last updated on Saturday, April 10, 2004
© 1992-2003 Microsoft Corporation. All rights reserved.