XSL Style Sheet

Here is an example of the type of xsl file we will want to build using perl.

This one loops through the XML file and displays wines if the year equals 1985

As you can see the document is a mixture of xhtml tags and the newer XSL stylesheet tags (shown in red).

<?xml version="1.0" ?> 
<xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:template match="/">
<html>
<head><meta http-equiv="pragma" content="no-cache" expires="-1"
/></head>
<body style="background-color:#000000;font-family:Arial;
font-size:12pt;color:wheat;">
<h2>Blottos Vintage Xml Winelist</h2>
<a href="../blottoxml.htm" >Click here for a new selection</a>
<table border="1">
<xsl:for-each select="winelist/wine">
   <xsl:if test="year[.='1985']">
      <tr align="center">
      <div style="background-color:aabbcc;color:white;">
      <td>  <xsl:value-of select="name" />   </td>
      <td>  <xsl:value-of select="price" />  </td> 
      <td>  <xsl:value-of select="year" />   </td>
      </div>
      </tr>
   </xsl:if>
</xsl:for-each>
</table>
</body></html>
</xsl:template></xsl:transform>

Don't Cache the XSL Page

Note the meta tag in the head.
Every time the user queries the database a new XSL file is generated by the perl script.
It is important that the browser does not use old XSL files stored in the browser cache as these represent old queries.

The line
<meta http-equiv='pragma' content='no-cache' />
is supposed to stop the browser from caching the style sheet.

Unfortunately not all browsers and proxies implement the no-cache tag.
If the system you are using has this problem there is another solution involving adding randon numbers to urls .
See your tutor for details.