XSLT <xsl:atribut>
Referensi Elemen XSLT Lengkap
Definisi dan Penggunaan
Elemen <xsl:attribute> digunakan untuk menambahkan atribut ke elemen.
Catatan: Elemen <xsl:attribute> menggantikan atribut yang ada dengan nama yang setara.
Sintaksis
<xsl:attribute name="attributename" namespace="uri">
<!-- Content:template -->
</xsl:attribute>
Atribut
Attribute | Value | Description |
---|---|---|
name | attributename | Required. Specifies the name of the attribute |
namespace | URI | Optional. Defines the namespace URI for the attribute |
Contoh 1
Tambahkan atribut sumber ke elemen gambar:
<picture>
<xsl:attribute name="source"/>
</picture>
Contoh 2
Tambahkan atribut sumber ke elemen gambar dan isi dengan nilai dari "gambar/nama" :
<picture>
<xsl:attribute name="source">
<xsl:value-of select="images/name" />
</xsl:attribute>
</picture>
Contoh 3
Buat set atribut yang dapat diterapkan ke elemen output apa pun:
<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>
Referensi Elemen XSLT Lengkap