XSLT <xsl: attribute> -Element
Definition und Verwendung
<Xsl: attribute> -Element wird verwendet, Attribute Elemente hinzuzufügen.
HINWEIS: <xsl: attribute> -Element ersetzt ein vorhandenes Attribut mit dem gleichen Namen.
Grammatik
<xsl:attribute name="attributename" namespace="uri">
<!-- Content:template -->
</xsl:attribute>
<!-- Content:template -->
</xsl:attribute>
Immobilien
属性 | 值 | 描述 |
---|---|---|
name | attributename | 必需。规定属性的名称。 |
namespace | URI | 可选。为属性定义命名空间的 URI。 |
Beispiel 1
Zusätzlich zu den Bildelementquelle Attribute:
<picture>
<xsl:attribute name="source"/>
</picture>
<xsl:attribute name="source"/>
</picture>
Beispiel 2
Das Hinzufügen der Bildelementquelle Attribute und Verwendung "images / name" in den Wert ihrer Zuordnung:
<picture>
<xsl:attribute name="source">
<xsl:value-of select="images/name" />
</xsl:attribute>
</picture>
<xsl:attribute name="source">
<xsl:value-of select="images/name" />
</xsl:attribute>
</picture>
Beispiel 3
Erstellen Sie eine Reihe von Attributen kann auf jede beliebige Ausgangselement angewendet werden:
<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>
<xsl:attribute name="fname">Arial</xsl:attribute>
<xsl:attribute name="size">14px</xsl:attribute>
<xsl:attribute name="color">red</xsl:attribute>
</xsl:attribute-set>
Komplette XSLT - Element - Referenzhandbuch