XSLT <xsl:attribute> Element
Complete XSLT Element Reference
Definition and Usage
The <xsl:attribute> element is used to add attributes to elements.
Note: The <xsl:attribute> element replaces existing
attributes with equivalent names.
Syntax
<xsl:attribute name="attributename" namespace="uri">
<!-- Content:template -->
</xsl:attribute>
|
Attributes
| Attribute |
Value |
Description |
| name |
attributename |
Required. Specifies the name of the attribute |
| namespace |
URI |
Optional. Defines the namespace URI for the attribute |
Example 1
Add a source attribute to the picture element:
<picture>
<xsl:attribute name="source"/>
</picture>
|
Example 2
Add a source attribute to the picture element and fill it with values from
"images/name" :
<picture>
<xsl:attribute name="source">
<xsl:value-of select="images/name" />
</xsl:attribute>
</picture>
|
Example 3
Create an attribute-set that can be applied to any output element:
<xsl:attribute-set name="font">
<xsl:attribute name="fname">Arial</xsl:attribute>
<xsl:attribute name="size">14px</xsl:attribute>
<xsl:attribute name="color">red</xsl:attribute>
</xsl:attribute-set>
|
Complete XSLT Element Reference
Create a free Flash website with our simple, online web design editing platform. Stunning templates
and user-friendly tools make website building easy and fun.
Start Creating your free website now!

Whether you're new to XML or already an advanced user, the user-friendly views and powerful entry helpers, wizards, and debuggers in XMLSpy are designed to meet your XML and Web development needs from start to finish.
New features in Version 2010!
- XML editor
- Graphical XML Schema / DTD editors
- XSLT 1.0/2.0 editor, debugger, profiler
- XQuery editor, debugger, profiler
- XBRL validator, taxonomy editor, taxonomy wizard
- Support for Office Open XML (OOXML)
- Graphical WSDL 1.1/2.0 editor & SOAP debugger
- JSON editing & conversion
- Java, C#, C++ code generation
- 32-bit and 64-bit versions
- And much more!
Download a free trial today!
|
|
|
|