Latest web development tutorials

<: Atributo XSL> elemento XSLT

Manual de XSLT elementos de referencia Completo manual de referencia del elemento XSLT

Definición y Uso

<Xsl: attribute> elemento se utiliza para añadir atributos a los elementos.

NOTA: <xsl: attribute> reemplaza un atributo existente con el mismo nombre.


gramática

<xsl:attribute name="attributename" namespace="uri">

<!-- Content:template -->

</xsl:attribute>

propiedad

属性 描述
name attributename 必需。规定属性的名称。
namespace URI 可选。为属性定义命名空间的 URI。

Ejemplo 1

Agregando a los atributos de fuente de elementos de imagen:

<picture>
<xsl:attribute name="source"/>
</picture>

Ejemplo 2

Agregando al elemento de imagen atributos de fuente, y el uso de "imágenes / nombre" en el valor de su asignación:

<picture>
<xsl:attribute name="source">
<xsl:value-of select="images/name" />
</xsl:attribute>
</picture>

Ejemplo 3

Crear un conjunto de atributos pueden ser aplicadas 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>


Manual de XSLT elementos de referencia Completo manual de referencia del elemento XSLT