Attributes

I want to add something like this to the footer so readers can contact me if there's a problem with the page:

Elliotte Rusty Harold<br/>
elharo@metalab.unc.edu

This information comes from the maintainer element:

  <maintainer email="elharo@metalab.unc.edu" 
              url="http://www.macfaq.com/personal.html">
    <name>
      <first_name>Elliotte</first_name> 
      <middle_name>Rusty</middle_name> 
      <last_name>Harold</last_name>
    </name>
  </maintainer>

So we need a way to get content from attributes in the input document. This is accomplished by prefixing the attribute name with @.

  <xsl:template match="catalog">
    <head>
       <title><xsl:value-of select="category"/></title>      
    </head>
    <body>
       <h1><xsl:value-of select="category"/></h1>      
       <xsl:apply-templates select="composition"/>
       <hr/>
       Copyright <xsl:value-of select="copyright"/><br/>
       Last Modified: <xsl:value-of select="last_updated"/><br/>
       <xsl:apply-templates select="maintainer"/>
    </body>
  </xsl:template>

  <xsl:template match="maintainer">
    <xsl:value-of select="name"/><br/>
    <xsl:value-of select="@email"/>
  </xsl:template>  

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

Copyright 1999 Elliotte Rusty Harold
elharo@metalab.unc.edu
Last Modified October 10, 1999