summaryrefslogtreecommitdiffstats
path: root/xslt/report-templates/Loan_View.xsl
blob: d52f74cb6c1487ee573291505becdfa1c2e9bd87 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
<?xml version="1.0"?>
<!-- WARNING: Tellico uses tc as the internal namespace declaration, and it must be identical here!! -->
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                xmlns:tc="http://periapsis.org/tellico/"
                xmlns:str="http://exslt.org/strings"
                extension-element-prefixes="str"
                exclude-result-prefixes="tc"
                version="1.0">

<!--
   ===================================================================
   Tellico XSLT file - Group View Report

   Copyright (C) 2005-2006 Robby Stephenson - robby@periapsis.org

   This XSLT stylesheet is designed to be used with the 'Tellico'
   application, which can be found at http://www.periapsis.org/tellico/

   ===================================================================
-->

<!-- import common templates -->
<!-- location depends on being installed correctly -->
<xsl:import href="../tellico-common.xsl"/>

<xsl:output method="html"
            indent="yes"
            doctype-public="-//W3C//DTD HTML 4.01//EN"
            doctype-system="http://www.w3.org/TR/html4/strict.dtd"
            encoding="utf-8"/>

<xsl:param name="filename"/>
<xsl:param name="cdate"/>

<!-- Sort using user's preferred language -->
<xsl:param name="lang"/>

<xsl:key name="entriesById" match="tc:entry" use="@id"/>
<xsl:key name="loansByDate" match="tc:loan" use="@dueDate"/>

<xsl:template match="/">
 <xsl:apply-templates select="tc:tellico"/>
</xsl:template>

<xsl:template match="tc:tellico">
 <html>
  <head>
   <style type="text/css">
   body {
        font-family: sans-serif;
        background-color: #fff;
   }
   #header-left {
        margin-top: 0;
        float: left;
        font-size: 80%;
        font-style: italic;
   }
   #header-right {
        margin-top: 0;
        float: right;
        font-size: 80%;
        font-style: italic;
   }
   h1.colltitle {
        margin: 0px;
        padding-bottom: 5px;
        font-size: 2em;
        text-align: center;
   }
   table {
        margin-left: auto;
        margin-right: auto;
        margin-bottom: 30px;
   }
   td.groupName {
        margin-top: 10px;
        margin-bottom: 2px;
        padding-left: 4px;
        background: #ccc;
        font-size: 1.1em;
        font-weight: bolder;
   }
   td.fieldName {
        margin-top: 10px;
        margin-bottom: 2px;
        color: #666;
        background-color: #ccc;
        font-size: 1.1em;
        text-align: center;
        font-style: italic;
        padding-left: 4px;
        padding-right: 4px;
   }
   tr.r0 {
   }
   tr.r1 {
        background-color: #eee;
   }
   td.field {
        margin: 0px;
        padding: 0px 10px 0px 10px;
        border: 1px solid #eee;
        text-align: left;
   }
   </style>
   <title>Tellico</title>
  </head>
  <body>
   <xsl:apply-templates select="tc:collection"/>
  </body>
 </html>
</xsl:template>

<xsl:template match="tc:collection">
 <p id="header-left"><xsl:value-of select="$filename"/></p>
 <p id="header-right"><xsl:value-of select="$cdate"/></p>
 <h1 class="colltitle">
  <xsl:value-of select="@title"/>
 </h1>

 <table>
  <tbody>
   <!-- TODO: this would need to be fixed for multiple collections -->
   <xsl:for-each select="../tc:borrowers/tc:borrower/tc:loan[generate-id(.)=generate-id(key('loansByDate', @dueDate)[1])]">
    <xsl:sort lang="$lang" select="@dueDate"/>
    <tr>
     <td class="groupName">
      <xsl:value-of select="@dueDate"/>
     </td>
     <td class="fieldName"><i18n>Borrower</i18n></td>      
     <td class="fieldName"><i18n>Loan Date</i18n></td>      
     <td class="fieldName"><i18n>Note</i18n></td>
    </tr>
    
    <xsl:for-each select="key('loansByDate', @dueDate)">
     <tr class="r{position() mod 2}">
      <td class="field">
       <xsl:value-of select="key('entriesById', @entryRef)//tc:title"/>
      </td>
      <td class="field">
       <xsl:value-of select="../@name"/>
      </td>
      <td class="field">
       <xsl:value-of select="@loanDate"/>
      </td>
      <td class="field">
       <p><xsl:value-of select="text()"/></p>
      </td>
     </tr>
    </xsl:for-each>
   </xsl:for-each>
   
  </tbody>
 </table>

 <table>
  <tbody>
   <!-- TODO: this would need to be fixed for multiple collections -->
   <xsl:for-each select="../tc:borrowers/tc:borrower">
    <xsl:sort lang="$lang" select="@name"/>
    <tr>
     <td class="groupName">
      <xsl:value-of select="@name"/>
     </td>
     <td class="fieldName"><i18n>Loan Date</i18n></td>      
     <td class="fieldName"><i18n>Due Date</i18n></td>      
     <td class="fieldName"><i18n>Note</i18n></td>      
    </tr>
    
    <xsl:for-each select="tc:loan">
     <tr class="r{position() mod 2}">
      <td class="field">
       <xsl:value-of select="key('entriesById', @entryRef)//tc:title"/>
      </td>
      <td class="field">
       <xsl:value-of select="@loanDate"/>
      </td>
      <td class="field">
       <xsl:value-of select="@dueDate"/>
      </td>
      <td class="field">
       <p><xsl:value-of select="text()"/></p>
      </td>
     </tr>
    </xsl:for-each>
   </xsl:for-each>
   
  </tbody>
 </table>

 <!--
 <h4><a href="http://www.periapsis.org/tellico/"><i18n>Generated by Tellico</i18n></a></h4>
-->
</xsl:template>

</xsl:stylesheet>
<!-- Local Variables: -->
<!-- sgml-indent-step: 1 -->
<!-- sgml-indent-data: 1 -->
<!-- End: -->