Attribute Value Templates

It would be nice to make the maintainer's name a link to his home page, and his email address a mailto: link. In other words,we want to add this to the footer:

  <a href="">Elliotte Rusty Harold</a><br/>
  <a href=""></a>

So we need a way to copy nodes from the input document to attribute values in the output document. This is done with an attribute value template

  <xsl:template match="maintainer">
    <a href="{@url}"><xsl:value-of select="name"/></a><br/>
    <a href="mailto:{@email}"><xsl:value-of select="@email"/></a>

An attribute value template is a select expression inside curly braces such as {@url}. Here the attribute value template selects attribute values in the input document, but it can also select element content or more complicated expressions. Notice that the attribute value template does not have to be the only thing in the attribute value. There can even be more than one attribue value templates in an attribute value.

View Transformed Document in Netscape
Previous | Next | Top | Cafe con Leche

Copyright 1999 Elliotte Rusty Harold
Last Modified October 10, 1999