O'Reilly logo

XSLT, 2nd Edition by Doug Tidwell

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Name

<xsl:attribute>

Allows you to create an attribute in the output document. Using the <xsl:attribute> instruction allows you to determine the name or content of an attribute at runtime. You can build the attribute’s name or value from parts of the input document, hardcoded text, values returned by functions, global variables, and any other value you can access from your stylesheet. You can also use <xsl:if> to determine whether the attribute should be created at all.

Category

Instruction.

Required Attribute

name

The name attribute defines the name of the attribute created by the <xsl:attribute> element. (No matter how you try to say this, talking about the attributes of the <xsl:attribute> element is confusing, isn’t it?)

Optional Attributes

namespace

The namespace attribute defines the namespace URI that should be used for this attribute in the output document. You don’t have control over the namespace prefix used; the only thing you specify with the namespace attribute is the namespace’s URI.

[2.0] select

An XPath expression that defines the content of this attribute. If the <xsl:attribute> element has a select attribute, the element must be empty.

[2.0] separator

Defines the characters that separate multiple values generated by the <xsl:attribute> instruction. If <xsl:attribute> has a select attribute, the default value is a single space (#x20). Without a select attribute, the default value is a zero-length string (""). The separator attribute overrides the default value whether select ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required