XSLT <xsl:Attribut>
❮ Vollständige XSLT-Elementreferenz
Definition und Verwendung
Das Element <xsl:attribute> wird verwendet, um Attribute zu Elementen hinzuzufügen.
Hinweis: Das Element <xsl:attribute> ersetzt vorhandene Attribute durch entsprechende Namen.
Syntax
<xsl:attribute name="attributename" namespace="uri">
<!-- Content:template -->
</xsl:attribute>
Attribute
Attribute | Value | Description |
---|---|---|
name | attributename | Required. Specifies the name of the attribute |
namespace | URI | Optional. Defines the namespace URI for the attribute |
Beispiel 1
Fügen Sie dem Bildelement ein Quellattribut hinzu:
<picture>
<xsl:attribute name="source"/>
</picture>
Beispiel 2
Fügen Sie dem Bildelement ein Quellattribut hinzu und füllen Sie es mit Werten aus "images/name" :
<picture>
<xsl:attribute name="source">
<xsl:value-of select="images/name" />
</xsl:attribute>
</picture>
Beispiel 3
Erstellen Sie einen Attributsatz, der auf jedes Ausgabeelement angewendet werden kann:
<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>
❮ Vollständige XSLT-Elementreferenz