Reflowed and split cscweb.xsl into smaller xsl files.
[www/www.git] / xsl / books.xsl
1 <?xml version='1.0'?>
2
3 <xsl:stylesheet version="1.1" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
4     xmlns:csc="http://www.csclub.uwaterloo.ca/cow" 
5     extension-element-prefixes="csc">
6
7 <xsl:template match="all-books">
8   <p>The books we currently own include:</p>
9   <table>
10     <tr>
11       <th>Title</th>
12       <th>Author</th>
13     </tr>
14     <xsl:for-each select="document('../books.xml')/booklist/book">
15       <xsl:variable name="class">
16         <xsl:choose>
17           <xsl:when test="position() mod 2 = 0">books1</xsl:when>
18           <xsl:otherwise>books2</xsl:otherwise>
19         </xsl:choose>
20       </xsl:variable>
21       <tr class="{$class}" >
22         <td>
23           <a href="{$pre}office/books/{translate(@isbn, ' ', '_')}.html">
24             <xsl:value-of select="@title" />
25             <xsl:if test="@edition != ''">
26               (<xsl:value-of select="@edition" />)
27             </xsl:if>
28           </a>
29         </td>
30         <td>
31           <xsl:value-of select="@author" />
32         </td>
33       </tr>
34       <xsl:document method="xml" encoding="ISO-8859-1" 
35           doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN"
36           doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"
37           href="{translate(concat($root, '/office/books/', @isbn, '.html'), ' ', '_')}">
38         <html>
39           <head>
40             <title>Book: <xsl:value-of select="@title" /></title>
41             <link rel="stylesheet" href="{$pre}default.css" type="text/css" />
42           </head>
43           <body><div>
44             <xsl:call-template name="header">
45               <xsl:with-param name="title" select="@title" />
46               <!-- TODO -->
47               <xsl:with-param name="pwd" select="concat($pwd, '/books')" />
48             </xsl:call-template>
49             <p>
50               <b>Title: </b> <xsl:value-of select="@title" /><br />
51               <b>Edition: </b> <xsl:value-of select="@edition" /><br />
52               <b>ISBN: </b> <xsl:value-of select="@isbn" /><br />
53               <b>Author: </b> <xsl:value-of select="@author" /><br />
54               <b>Published: </b> <xsl:value-of select="@published" /><br />
55             </p>
56             <xsl:call-template name="footer" />
57           </div></body>
58         </html>
59       </xsl:document>
60     </xsl:for-each>
61   </table>
62 </xsl:template>
63
64 </xsl:stylesheet>