xsl:attribute

  • Create an attribute in the resulting document.

    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
      <xsl:template name="test">
        <xsl:element name="test">
          <xsl:attribute name="test">value</xsl:attribute>
          ...
        </xsl:element>
      </xsl:template>
    </xsl:stylesheet>
    					
  • Use the name attribute to specify the attribute name.

  • Use the namespace attribute to specify the attribute's namespace.

  • The attribute is added as an attribute to any literal parent element or parent element specified using 'xsl:element'.