XSLT <xsl:attribute>要素
完全な XSLT 要素リファレンス
定義と使用法
<xsl:attribute> 要素は、要素に属性を追加するために使用します。
注: <xsl:attribute> 要素は、同じ名前の既存の属性を置き換えます。
構文
<xsl:attribute name="attributename" namespace="uri">
<!-- Content:template -->
</xsl:attribute>
<!-- Content:template -->
</xsl:attribute>
属性
| 属性 | 值 | 説明 |
|---|---|---|
| name | attributename | 必須。属性の名前を指定します。 |
| namespace | URI | 任意。属性の名前空間 URI を定義します。 |
例 1
picture 要素に source 属性を追加します:
<picture>
<xsl:attribute name="source"/>
</picture>
<xsl:attribute name="source"/>
</picture>
例 2
picture 要素に source 属性を追加し、"images/name" の値を割り当てます:
<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>
例 3
任意の出力要素に適用できる属性セットを作成します:
<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>
完全な XSLT 要素リファレンス その他の拡張