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
nameThe
nameattribute 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
namespaceThe
namespaceattribute 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 thenamespaceattribute is the namespace’s URI.- [2.0]
select An XPath expression that defines the content of this attribute. If the
<xsl:attribute>element has aselectattribute, 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 aselectattribute, the default value is a single space (#x20). Without aselectattribute, the default value is a zero-length string (""). Theseparatorattribute overrides the default value whetherselect ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access