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:



Library Navigation Links

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