Coding With Fun
Home Docker Django Node.js Articles Python pip guide FAQ Policy

XSLT <xsl:attribute> elemens


May 28, 2021 XSL T


Table of contents


XSLT and lt;xsl:attribute

You can add the properties of an element by using the .lt;xsl:attribute!


XSLT <xsl:attribute> elemens Complete XSLT element reference manual

Definitions and usages

The element is used to add properties to the element.

Note: The element replaces an existing property with the same name.


Grammar

<xsl:attribute name="attributename" namespace="uri">

<!-- Content:template -->

</xsl:attribute>

Property

Attributes value describe
name attributename Required.The name of the attribute is specified.
namespace URI Optional.Define the URI of the namespace for attributes.

Instance 1

Add the source property to the picture element:

<picture>
<xsl:attribute name="source"/>
</picture>

Instance 2

Add the source property to the picture element and assign it a value using the values in "images/name":

<picture>
<xsl:attribute name="source">
<xsl:value-of select="images/name" />
</xsl:attribute>
</picture>

Instance 3

Create a set of properties 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>

XSLT <xsl:attribute> elemens Complete XSLT element reference manual