<html> <head> <title>LISTING 1: XSL Style Sheet That Uses the Context Method</title> </head> <body> <PRE><?xml version="1.0"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/TR/WD-xsl"> BEGIN CALLOUT A <xsl:template match="/"> <TABLE BORDER="0" width="25%" cellpadding="4" align="center" noWrap="True"> <THEAD> <!-- Output the name of the row. --> <xsl:for-each select="/xml/s:Schema/s:ElementType[@name='row']/s:AttributeType" order-by="@name"> <th bgcolor="0000A0" align="center"> <font color="ffffff" face="arial,helvetica" size="2"> <b><xsl:value-of select="@name" /></b> </font> </th> </xsl:for-each> </THEAD> <TBODY CLASS="TableBody" id="tableBody"> <xsl:apply-templates select="/xml/rs:data/z:row" order-by="@CustomerID" /> </TBODY> </TABLE> </xsl:template> END CALLOUT A BEGIN CALLOUT B <xsl:template match="z:row"> <TR> <xsl:for-each select="/xml/s:Schema/s:ElementType[@name='row']/s:AttributeType"> <TD bgcolor="F47809" align="center" noWrap="True"> <font color="ffffff" face="arial,helvetica" size="2"> <xsl:value-of select="context(-2)/@*[nodeName()=context(-1)/@name]"/> </font> </TD> </xsl:for-each> </TR> </xsl:template> END CALLOUT B </xsl:stylesheet>