XSL example

                                                                                

<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<xsl:template match="/">
  <html>
   <head>
    <title>
	 Bridge Hands
	</title>
   </head>
   <body>
    <xsl:apply-templates/>
   </body>
  </html>
</xsl:template>

 <xsl:template match="GAME">
    <h1>
	 Bridge Hand
	</h1>
	<xsl:for-each select="@EVENT">
	 <p> Event: <xsl:value-of select="."/> </p>
	</xsl:for-each>
	<xsl:for-each select="@SITE">
	 <p> Site: <xsl:value-of select="."/> </p>
	</xsl:for-each>
	<xsl:for-each select="@DATE">
	 <p> Date: <xsl:value-of select="."/> </p>
	</xsl:for-each>
	<xsl:for-each select="@BOARD">
	 <p> Board: <xsl:value-of select="."/> </p>
	</xsl:for-each>
	<xsl:for-each select="@NORTH">
	 <p> North: <xsl:value-of select="."/> </p>
	</xsl:for-each>
	<xsl:for-each select="@SOUTH">
	 <p> South: <xsl:value-of select="."/> </p>
	</xsl:for-each>
	<xsl:for-each select="@EAST">
	 <p> East: <xsl:value-of select="."/> </p>
	</xsl:for-each>
	<xsl:for-each select="@WEST">
	 <p> West: <xsl:value-of select="."/> </p>
	</xsl:for-each>
	<xsl:for-each select="@SCORING">
	 <p> Scoring: <xsl:value-of select="."/> </p>
	</xsl:for-each>
	<xsl:for-each select="@SECTION">
	 <p> Section: <xsl:value-of select="."/> </p>
	</xsl:for-each>
	<xsl:for-each select="@STAGE">
	 <p> Stage: <xsl:value-of select="."/> </p>
	</xsl:for-each>
	<xsl:for-each select="@TABLE">
	 <p> Table: <xsl:value-of select="."/> </p>
	</xsl:for-each>
	<xsl:for-each select="@ROUND">
	 <p> Round: <xsl:value-of select="."/> </p>
	</xsl:for-each>
    <xsl:apply-templates/>
 </xsl:template>
 
 <xsl:template match="DEAL">
	<table>
	 <tr>
	  <td>
	   Dealer: <xsl:value-of select="@DEALER"/>
	   <br></br>
	   Vul: <xsl:value-of select="@VULNERABLE"/>
	   <br></br>
	  </td>
	  <td>
	   <xsl:apply-templates select="HAND[@SEAT='N']"/>
	  </td>
	  <td>
	  </td>
	 </tr>
	 <tr>
	  <td>
	   <xsl:apply-templates select="HAND[@SEAT='W']"/>
	  </td>
	  <td>
	  </td>
	  <td>
	   <xsl:apply-templates select="HAND[@SEAT='E']"/>
	  </td>
	 </tr>
	 <tr>
	  <td>
	  </td>
	  <td>
	   <xsl:apply-templates select="HAND[@SEAT='S']"/>
	  </td>
	  <td>
	  </td>
	 </tr>
	</table>
 </xsl:template>

 <xsl:template match="HAND">
   <img src="s.gif"/>
   <span><xsl:value-of select='SPADES'/></span>
   <br></br>
   <img src="h.gif"/>
   <span><xsl:value-of select='HEARTS'/></span>
   <br></br>
   <img src="d.gif"/>
   <span><xsl:value-of select='DIAMONDS'/></span>
   <br></br>
   <img src="c.gif"/>
   <span><xsl:value-of select='CLUBS'/></span>
 </xsl:template>

 <xsl:template match="AUCTION">
  <h3>The Auction</h3>
  <table>
   <tr>
    <xsl:apply-templates select="CALL[@ROUND='1']"/>
   </tr>
   <tr>
    <xsl:apply-templates select="CALL[@ROUND='2']"/>
   </tr>
   <tr>
    <xsl:apply-templates select="CALL[@ROUND='3']"/>
   </tr>
   <tr>
    <xsl:apply-templates select="CALL[@ROUND='4']"/>
   </tr>
   <tr>
    <xsl:apply-templates select="CALL[@ROUND='5']"/>
   </tr>
   <tr>
    <xsl:apply-templates select="CALL[@ROUND='6']"/>
   </tr>
   <tr>
    <xsl:apply-templates select="CALL[@ROUND='7']"/>
   </tr>
   <tr>
    <xsl:apply-templates select="CALL[@ROUND='8']"/>
   </tr>
   <tr>
    <xsl:apply-templates select="CALL[@ROUND='9']"/>
   </tr>
  </table>
  <xsl:apply-templates select="NOTE"/>
  <xsl:apply-templates select="CONTRACT"/>
  <xsl:apply-templates select="DECLARER"/>
 </xsl:template>

 <xsl:template match="CALL">
  <td>
   <xsl:value-of select="@LEVEL"/>
   <xsl:value-of select="@DENOMINATION"/>
   <xsl:for-each select="@NOTE">
	<xsl:text> </xsl:text>
	<sup>
	<small>
	<xsl:value-of select="."/>
	</small>
	</sup>
   </xsl:for-each>
  </td>
 </xsl:template>

 <xsl:template match="NOTE">
  <td>
   <br></br>
   <small>
   <xsl:value-of select="@NOTE_ID"/>:
   </small>
   <xsl:value-of select="."/>
  </td>
 </xsl:template>

 <xsl:template match="CONTRACT">
   Contract: <xsl:value-of select="."/>
 </xsl:template>

 <xsl:template match="DECLARER">
   Declarer: <xsl:value-of select="."/>
 </xsl:template>

 <xsl:template match="PLAY">
  <h3>The Play</h3>
  <table>
   <tr>
    <xsl:apply-templates select="CARD[@TRICK='1']"/>
   </tr>
   <tr>
    <xsl:apply-templates select="CARD[@TRICK='2']"/>
   </tr>
   <tr>
    <xsl:apply-templates select="CARD[@TRICK='3']"/>
   </tr>
   <tr>
    <xsl:apply-templates select="CARD[@TRICK='4']"/>
   </tr>
   <tr>
    <xsl:apply-templates select="CARD[@TRICK='5']"/>
   </tr>
   <tr>
    <xsl:apply-templates select="CARD[@TRICK='6']"/>
   </tr>
   <tr>
    <xsl:apply-templates select="CARD[@TRICK='7']"/>
   </tr>
   <tr>
    <xsl:apply-templates select="CARD[@TRICK='8']"/>
   </tr>
   <tr>
    <xsl:apply-templates select="CARD[@TRICK='9']"/>
   </tr>
   <tr>
    <xsl:apply-templates select="CARD[@TRICK='10']"/>
   </tr>
   <tr>
    <xsl:apply-templates select="CARD[@TRICK='11']"/>
   </tr>
   <tr>
    <xsl:apply-templates select="CARD[@TRICK='12']"/>
   </tr>
   <tr>
    <xsl:apply-templates select="CARD[@TRICK='13']"/>
   </tr>
  </table>
 </xsl:template>

 <xsl:template match="CARD">
  <td>
   <xsl:choose>
    <xsl:when test="@WINNER='TRUE'">
	 <u>
     <xsl:value-of select="."/>
     </u>
	</xsl:when>
    <xsl:when test="@WINNER!='TRUE'">
     <xsl:value-of select="."/>
	</xsl:when>
	<!--
    <xsl:other>
     <xsl:value-of select="."/>
	</xsl:other>
	-->
   </xsl:choose>
   <xsl:for-each select="@NOTE">
	<xsl:text> </xsl:text>
	<sup>
	<small>
	<xsl:value-of select="."/>
	</small>
	</sup>
   </xsl:for-each>
  </td>
 </xsl:template>

 <xsl:template match="TEXT">
  <br></br>
  <xsl:apply-templates/>
 </xsl:template>

</xsl:stylesheet>