6.3. Creating Attributes with the <xsl:attribute> Instruction Element

One of the most useful instruction elements is the <xsl:attribute> element, which, as its name indicates, creates attributes. It has two attributes, as shown in the following element model definition: the name attribute, which establishes the new attribute's name, and the namespace attribute, which can give a namespace URI for the attribute, if necessary.

<!-- Category: instruction -->

<xsl:attribute

  name = { qname }

  namespace = { uri-reference }>

  <!-- Content: template -->

</xsl:attribute>

Using <xsl:attribute> is a good example of how XSLT stylesheets, as well-formed XML data instances themselves, benefit from and can be interpreted by means of XML syntax rules for the ...

Get XSLT and XPATH: A Guide to XML Transformations 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.