home | O'Reilly's CD bookshelfs | FreeBSD | Linux | Cisco | Cisco Exam  


Book HomeXSLSearch this book

3.3. Attribute Value Templates

Although they're technically defined in the XSLT specification (in section 7.6.2, to be exact), we'll discuss attribute value templates here. An attribute value template is an XPath expression that is evaluated, and the result of that evaluation replaces the attribute value template. For example, we could create an HTML <table> element like this:

<table border="{@size}"/>

In this example, the XPath expression @size is evaluated, and its value, whatever that happens to be, is inserted into the output tree as the value of the border attribute. Attribute value templates can be used in any literal result elements in your stylesheet (for HTML elements and other things that aren't part of the XSLT namespace, for example). You can also use attribute value templates in the following XSLT attributes:

  • The name and namespace attributes of the <xsl:attribute> element

  • The name and namespace attributes of the <xsl:element> element

  • The format, lang, letter-value, grouping-separator, and grouping-size attributes of the <xsl:number> element

  • The name attribute of the <xsl:processing-instruction> element

  • The lang, data-type, order, and case-order attributes of the <xsl:sort> element



Library Navigation Links

Copyright © 2002 O'Reilly & Associates. All rights reserved.