XSLT <xsl: attribute> Element
Definicja i Wykorzystanie
<Xsl: attribute> Element służy do dodawania atrybutów do elementów.
UWAGA: <xsl: attribute> Element zastępuje istniejący atrybut o tej samej nazwie.
gramatyka
<xsl:attribute name="attributename" namespace="uri">
<!-- Content:template -->
</xsl:attribute>
<!-- Content:template -->
</xsl:attribute>
nieruchomość
属性 | 值 | 描述 |
---|---|---|
name | attributename | 必需。规定属性的名称。 |
namespace | URI | 可选。为属性定义命名空间的 URI。 |
Przykład 1
Dodanie do atrybutów źródłowych element obrazu:
<picture>
<xsl:attribute name="source"/>
</picture>
<xsl:attribute name="source"/>
</picture>
Przykład 2
Dodając do elementu obrazu atrybuty źródła i zastosowania "images / Name" w wartości ich pracy:
<picture>
<xsl:attribute name="source">
<xsl:value-of select="images/name" />
</xsl:attribute>
</picture>
<xsl:attribute name="source">
<xsl:value-of select="images/name" />
</xsl:attribute>
</picture>
Przykład 3
Utwórz zestaw atrybutów można zastosować do dowolnego elementu wyjściowego:
<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>
<xsl:attribute name="fname">Arial</xsl:attribute>
<xsl:attribute name="size">14px</xsl:attribute>
<xsl:attribute name="color">red</xsl:attribute>
</xsl:attribute-set>
Kompletna instrukcja XSLT element odniesienia