XSLT <xsl:attribute>
❮完全なXSLT要素リファレンス
定義と使用法
<xsl:attribute>要素は、要素に属性を追加するために使用されます。
注:<xsl:attribute>要素は、既存の属性を同等の名前に置き換えます。
構文
<xsl:attribute name="attributename" namespace="uri">
<!-- Content:template -->
</xsl:attribute>
属性
Attribute | Value | Description |
---|---|---|
name | attributename | Required. Specifies the name of the attribute |
namespace | URI | Optional. Defines the namespace URI for the attribute |
例1
画像要素にソース属性を追加します。
<picture>
<xsl:attribute name="source"/>
</picture>
例2
画像要素にソース属性を追加し、「images / name」の値を入力します。
<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>
❮完全なXSLT要素リファレンス