XSLT <xsl:attribuut>
❮Volledige XSLT-elementreferentie
Definitie en gebruik
Het <xsl:attribute> element wordt gebruikt om attributen aan elementen toe te voegen.
Opmerking: het element <xsl:attribute> vervangt bestaande attributen door equivalente namen.
Syntaxis
<xsl:attribute name="attributename" namespace="uri">
<!-- Content:template -->
</xsl:attribute>
attributen
Attribute | Value | Description |
---|---|---|
name | attributename | Required. Specifies the name of the attribute |
namespace | URI | Optional. Defines the namespace URI for the attribute |
voorbeeld 1
Voeg een bronattribuut toe aan het afbeeldingselement:
<picture>
<xsl:attribute name="source"/>
</picture>
Voorbeeld 2
Voeg een bronattribuut toe aan het afbeeldingselement en vul het met waarden uit "images/name" :
<picture>
<xsl:attribute name="source">
<xsl:value-of select="images/name" />
</xsl:attribute>
</picture>
Voorbeeld 3
Maak een attributenset die op elk uitvoerelement kan worden toegepast:
<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>
❮Volledige XSLT-elementreferentie