XSLT <xsl:atributo>
❮ Referencia completa del elemento XSLT
Definición y uso
El elemento <xsl:attribute> se utiliza para agregar atributos a los elementos.
Nota: El elemento <xsl:attribute> reemplaza los atributos existentes con nombres equivalentes.
Sintaxis
<xsl:attribute name="attributename" namespace="uri">
<!-- Content:template -->
</xsl:attribute>
Atributos
Attribute | Value | Description |
---|---|---|
name | attributename | Required. Specifies the name of the attribute |
namespace | URI | Optional. Defines the namespace URI for the attribute |
Ejemplo 1
Agregue un atributo de origen al elemento de imagen:
<picture>
<xsl:attribute name="source"/>
</picture>
Ejemplo 2
Agregue un atributo de origen al elemento de imagen y rellénelo con valores de "imágenes/nombre":
<picture>
<xsl:attribute name="source">
<xsl:value-of select="images/name" />
</xsl:attribute>
</picture>
Ejemplo 3
Cree un conjunto de atributos que se pueda aplicar a cualquier elemento de salida:
<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>
❮ Referencia completa del elemento XSLT