Attribute Value Templates

The name attribute value template has nothing to do with templates as we’ve been using them—that is, to create stylesheet rules. Instead, using an attribute value template just means that the value of an attribute can be set at execution time.

In this case, you can set an attribute to the value of an XPath expression (this topic is covered more thoroughly in Chapter 4) if you enclose that expression in curly braces, { and }. For example, to set the NAME attribute to the string value of a <DESCRIPTION> element that is a child of the context node, you could assign that value like this: NAME={DESCRIPTION}.

Here’s the correct XSLT to use to assign the values from the <NAME>, <MASS>, <RADIUS>, and <DAY> elements to attributes ...

Get Inside XSLT now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.