Latest web development tutorials

XSLT <xsl: attribute> elemento

Manual de XSLT Elements Reference Manual Completo XSLT elemento de referência

Definição e Uso

<Xsl: attribute> elemento é usado para adicionar atributos aos elementos.

NOTA: <xsl: attribute> elemento substitui um atributo existente com o mesmo nome.


gramática

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

<!-- Content:template -->

</xsl:attribute>

propriedade

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

exemplo 1

Somando-se os atributos de origem picture element:

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

exemplo 2

Somando-se o elemento de imagem atributos fonte e uso de "imagens / name" no valor da sua missão:

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

exemplo 3

Criar um conjunto de atributos podem ser aplicados a qualquer elemento de saída:

<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 Elements Reference Manual Completo XSLT elemento de referência