Name

<xsl:attribute>

Synopsis

<xsl:attribute name=" name " >...</xsl:attribute>

Description

Adds an attribute with the given name to an element in the result tree. There can only be one attribute with a given name added to a specific element. The contents of the <xsl:attribute> element form the value of the attribute:

<xsl:element name="book" >
  <xsl:attribute name="title">Moby Dick</xsl:attribute>
  <xsl:text>This is about a whale</xsl:text>
</xsl:element>

This creates the following element in the result tree:

<book title="Moby Dick" >This is about a whale</book>

Get Webmaster in a Nutshell, Second 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.