XML and ASP.NET

only for RuBoard

xsl:attribute-set

Defines a named set of attributes.

Attribute sets are used by specifying a use-attribute-sets attribute on xsl:element , xsl:copy, or xsl:attribute-set elements.

Attributes

Attribute Name

Enforced

Description

Values

name

Required

The name of the attribute set definition

QName

use-attribute-sets

Optional

A list of attribute set names to use for the definition

White space delimited list of attribute set QNames

Example

Given the XML instance document, links.xml :

<?xml version="1.0" encoding="utf-8" ?> <links> <link id="newriders" URL="http://www.newriders.com" name="NewRiders.com" description="Available books by New Riders" /> <link id="vbdna" URL="http://www.xmlandasp.net" name="Xmlandasp.net" description="Articles and samples available for VB, DNA, and .NET" /> </links>

The following template rule generates a table with cells left-aligned and backcolor silver:

<html> <body> <table> <xsl:template match="link"> <tr> <td xsl:use-attribute-sets="leftsilver"> <xsl:value-of select="@name" /> </td> </tr> </xsl:template> <xsl:attribute-set name="leftsilver"> <xsl:attribute name="align">left</xsl:attribute> <xsl:attribute name="bgcolor">silver</xsl:attribute> </xsl:attribute-set> </table> </body> </html>

This results in the following markup:

<html> <body> <table> <tr> <td align="left" bgcolor="silver"> NewRiders.com </td> </tr> <tr> <td align="left" bgcolor="silver"> Xmlandasp.net </td> </tr> </table> </body> </html>

Parent Elements

xsl:stylesheet, xsl:transform

Child Elements

xsl:attribute

only for RuBoard

Категории