1 | <?xml version="1.0" encoding="ISO-8859-1"?>
|
---|
2 | <xsl:stylesheet version="1.0"
|
---|
3 | xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
---|
4 | xmlns:java="http://xml.apache.org/xslt/java"
|
---|
5 | xmlns:util="xalan://org.greenstone.gsdl3.util.XSLTUtil"
|
---|
6 | xmlns:gslib="http://www.greenstone.org/skinning"
|
---|
7 | xmlns:gsf="http://www.greenstone.org/greenstone3/schema/ConfigFormat"
|
---|
8 | extension-element-prefixes="java util"
|
---|
9 | exclude-result-prefixes="java util gsf">
|
---|
10 |
|
---|
11 | <!-- use the 'main' layout -->
|
---|
12 | <xsl:import href="layouts/main.xsl"/>
|
---|
13 |
|
---|
14 | <!-- style includes global params interface_name, library_name -->
|
---|
15 | <xsl:include href=".old/berrytools.xsl"/>
|
---|
16 | <xsl:include href="document-scripts.xsl"/>
|
---|
17 |
|
---|
18 | <xsl:variable name="bookswitch">
|
---|
19 | <xsl:choose>
|
---|
20 | <xsl:when test="/page/pageRequest/paramList/param[@name='book']/@value">
|
---|
21 | <xsl:value-of select="/page/pageRequest/paramList/param[@name='book']/@value"/>
|
---|
22 | </xsl:when>
|
---|
23 | <xsl:otherwise>off</xsl:otherwise>
|
---|
24 | </xsl:choose>
|
---|
25 | </xsl:variable>
|
---|
26 |
|
---|
27 | <!-- set page title -->
|
---|
28 | <xsl:template name="pageTitle"><gslib:documentTitle/></xsl:template>
|
---|
29 |
|
---|
30 | <!-- set page breadcrumbs -->
|
---|
31 | <xsl:template name="breadcrumbs">
|
---|
32 | <gslib:siteLink/><gslib:rightArrow/>
|
---|
33 | <gslib:collectionNameLinked/><gslib:rightArrow/>
|
---|
34 | <a>
|
---|
35 | <xsl:attribute name="href">
|
---|
36 | <xsl:value-of select="$library_name"/>?a=d&c=<xsl:value-of select="$collName"/>&d=<xsl:value-of select="/page/pageResponse/document/documentNode[1]/@nodeID"/>&dt=<xsl:value-of select="/page/pageResponse/document/documentNode/@docType"/>&p.a=b&p.s=<xsl:value-of select="/page/pageResponse/service/@name"/>
|
---|
37 | </xsl:attribute>
|
---|
38 | <xsl:variable name="documentTitleVar">
|
---|
39 | <gslib:documentTitle/>
|
---|
40 | </xsl:variable>
|
---|
41 | Document
|
---|
42 | </a>
|
---|
43 | </xsl:template>
|
---|
44 |
|
---|
45 | <xsl:template match="/">
|
---|
46 | <xsl:choose>
|
---|
47 | <!-- if this is the realistic books version of the page -->
|
---|
48 | <xsl:when test="$bookswitch = 'flashxml'">
|
---|
49 | <html>
|
---|
50 | <body>
|
---|
51 | <xsl:apply-templates select="/page/pageResponse/document"/>
|
---|
52 | </body>
|
---|
53 | </html>
|
---|
54 | </xsl:when>
|
---|
55 | <!-- if this is the regular version of the page -->
|
---|
56 | <xsl:otherwise>
|
---|
57 | <xsl:apply-imports/>
|
---|
58 | </xsl:otherwise>
|
---|
59 | </xsl:choose>
|
---|
60 | </xsl:template>
|
---|
61 |
|
---|
62 | <!-- the page content -->
|
---|
63 | <xsl:template match="/page/pageResponse/document">
|
---|
64 | <xsl:if test="$bookswitch = 'off'">
|
---|
65 | <!-- Add the Javascript that adds and removes highlighting ( *** in document-scripts.xsl *** ) -->
|
---|
66 | <xsl:call-template name="highlightingScript"/>
|
---|
67 |
|
---|
68 | <!-- Add the Javascript that expands and collapses sections ( *** in document-scripts.xsl *** ) -->
|
---|
69 | <xsl:call-template name="expansionScript"/>
|
---|
70 |
|
---|
71 | <!-- show the little berries for this document -->
|
---|
72 | <xsl:call-template name="documentBerryForDocumentPage"/>
|
---|
73 |
|
---|
74 | <table id="rightSidebar">
|
---|
75 | <tr><td>
|
---|
76 | <xsl:call-template name="viewOptions"/>
|
---|
77 | </td></tr>
|
---|
78 | <tr><td>
|
---|
79 | <!-- the sidebar -->
|
---|
80 | <div id="contentsArea">
|
---|
81 | <!-- show the berry basket if it's turned on -->
|
---|
82 | <gslib:berryBasket/>
|
---|
83 |
|
---|
84 | <!-- the book's cover image -->
|
---|
85 | <div id="coverImage"><gslib:coverImage/></div>
|
---|
86 |
|
---|
87 | <!-- the contents -->
|
---|
88 | <div id="tableOfContents">
|
---|
89 | <xsl:apply-templates select="documentNode" mode="TOC"/>
|
---|
90 | </div>
|
---|
91 | </div>
|
---|
92 | </td></tr>
|
---|
93 | </table>
|
---|
94 | </xsl:if>
|
---|
95 |
|
---|
96 | <!-- display the document -->
|
---|
97 | <xsl:choose>
|
---|
98 | <xsl:when test="@external != ''">
|
---|
99 | <xsl:call-template name="externalPage">
|
---|
100 | <xsl:with-param name="external" select="@external"/>
|
---|
101 | </xsl:call-template>
|
---|
102 | </xsl:when>
|
---|
103 | <xsl:when test="$bookswitch = 'flashxml'">
|
---|
104 | <xsl:apply-templates mode="flashxml"/>
|
---|
105 | </xsl:when>
|
---|
106 | <xsl:when test="$bookswitch = 'on'">
|
---|
107 | <!-- *** in document-scripts.xsl *** -->
|
---|
108 | <xsl:call-template name="realisticBooksScript"/>
|
---|
109 | </xsl:when>
|
---|
110 | <xsl:otherwise>
|
---|
111 | <div id="gs-document-text" class="documenttext">
|
---|
112 | <xsl:apply-templates select="documentNode" mode="document"/>
|
---|
113 | </div>
|
---|
114 | </xsl:otherwise>
|
---|
115 | </xsl:choose>
|
---|
116 |
|
---|
117 | <div class="clear"><xsl:text> </xsl:text></div>
|
---|
118 | </xsl:template>
|
---|
119 |
|
---|
120 | <!-- Highlight annotations if requested -->
|
---|
121 | <xsl:template match="annotation">
|
---|
122 | <xsl:choose>
|
---|
123 | <xsl:when test="/page/pageRequest/paramList/param[@name='hl' and @value='on']">
|
---|
124 | <span class="termHighlight"><xsl:value-of select="."/></span>
|
---|
125 | </xsl:when>
|
---|
126 | <xsl:otherwise>
|
---|
127 | <span class="noTermHighlight"><xsl:value-of select="."/></span>
|
---|
128 | </xsl:otherwise>
|
---|
129 | </xsl:choose>
|
---|
130 | </xsl:template>
|
---|
131 |
|
---|
132 | <!-- This template is used to display the document content -->
|
---|
133 | <xsl:template match="documentNode" mode="document">
|
---|
134 | <a name="{@nodeID}"><xsl:text> </xsl:text></a>
|
---|
135 | <!-- Section header -->
|
---|
136 | <table><tr>
|
---|
137 | <!-- Expand/collapse button -->
|
---|
138 | <td class="headerTD">
|
---|
139 | <div id="dtoggle{@nodeID}" onclick="toggleSection('{@nodeID}');">
|
---|
140 | <xsl:attribute name="class">
|
---|
141 | <xsl:choose>
|
---|
142 | <xsl:when test="nodeContent and not(documentNode)">icon leafNode toggleImageCollapse</xsl:when>
|
---|
143 | <xsl:otherwise>icon toggleImageCollapse</xsl:otherwise>
|
---|
144 | </xsl:choose>
|
---|
145 | </xsl:attribute>
|
---|
146 | </div>
|
---|
147 | </td>
|
---|
148 |
|
---|
149 | <!-- Automatic section number -->
|
---|
150 | <td class="headerTD">
|
---|
151 | <p>
|
---|
152 | <xsl:attribute name="class"><xsl:value-of select="util:hashToDepthClass(@nodeID)"/> sectionHeader</xsl:attribute>
|
---|
153 |
|
---|
154 | <xsl:if test="util:hashToSectionId(@nodeID)">
|
---|
155 | <span class="sectionNumberSpan">
|
---|
156 | <xsl:value-of select="util:hashToSectionId(@nodeID)"/>
|
---|
157 | <xsl:text> </xsl:text>
|
---|
158 | </span>
|
---|
159 | </xsl:if>
|
---|
160 | <xsl:value-of disable-output-escaping="yes" select="metadataList/metadata[@name = 'Title']"/>
|
---|
161 | </p>
|
---|
162 | </td>
|
---|
163 |
|
---|
164 | <!-- "back to top" link -->
|
---|
165 | <xsl:if test="util:hashToDepthClass(@nodeID) != 'sectionHeaderDepthTitle'">
|
---|
166 | <td class="backToTop headerTD">
|
---|
167 | <a href="#top">
|
---|
168 | <xsl:text disable-output-escaping="yes">▲back to top</xsl:text>
|
---|
169 | </a>
|
---|
170 | </td>
|
---|
171 | </xsl:if>
|
---|
172 | </tr></table>
|
---|
173 |
|
---|
174 | <!-- Section text -->
|
---|
175 | <div id="doc{@nodeID}" class="sectionContainer" style="display:block;">
|
---|
176 | <xsl:for-each select="nodeContent">
|
---|
177 | <xsl:for-each select="node()">
|
---|
178 | <xsl:choose>
|
---|
179 | <xsl:when test="not(name())">
|
---|
180 | <xsl:value-of select="." disable-output-escaping="yes"/>
|
---|
181 | </xsl:when>
|
---|
182 | <xsl:otherwise>
|
---|
183 | <xsl:apply-templates select="."/>
|
---|
184 | </xsl:otherwise>
|
---|
185 | </xsl:choose>
|
---|
186 | </xsl:for-each>
|
---|
187 | </xsl:for-each>
|
---|
188 | <xsl:if test="documentNode">
|
---|
189 | <xsl:apply-templates select="documentNode" mode="document"/>
|
---|
190 | </xsl:if>
|
---|
191 | </div>
|
---|
192 |
|
---|
193 | </xsl:template>
|
---|
194 |
|
---|
195 | <!-- This template is used to display the table of contents -->
|
---|
196 | <xsl:template match="documentNode" mode="TOC">
|
---|
197 |
|
---|
198 | <!-- check if this is the currently selected table of contents item -->
|
---|
199 | <xsl:variable name="isCurrent" select="nodeContent"/>
|
---|
200 |
|
---|
201 | <!-- formulate the link -->
|
---|
202 | <xsl:variable name="contentsLink">
|
---|
203 | <xsl:value-of select='$library_name'/>?a=d&c=<gslib:collectionNameShort/>&d=<xsl:value-of select='@nodeID'/><xsl:if test="documentNode">.pr</xsl:if>&sib=1
|
---|
204 | </xsl:variable>
|
---|
205 |
|
---|
206 | <ul>
|
---|
207 | <table><tr>
|
---|
208 | <!-- The expand/collapse button (not displayed for the top level node) -->
|
---|
209 | <xsl:if test="util:hashToDepthClass(@nodeID) != 'sectionHeaderDepthTitle'">
|
---|
210 | <td>
|
---|
211 | <xsl:choose>
|
---|
212 | <xsl:when test="not(nodeContent and not(documentNode))">
|
---|
213 | <div id="ttoggle{@nodeID}" onclick="toggleSection('{@nodeID}');" class="icon toggleImageCollapse"/>
|
---|
214 | </xsl:when>
|
---|
215 | <xsl:otherwise>
|
---|
216 | <div class="icon"/>
|
---|
217 | </xsl:otherwise>
|
---|
218 | </xsl:choose>
|
---|
219 | </td>
|
---|
220 | </xsl:if>
|
---|
221 |
|
---|
222 | <!-- The chapter/page icon -->
|
---|
223 | <td>
|
---|
224 | <div>
|
---|
225 | <xsl:attribute name="class">
|
---|
226 | <xsl:choose>
|
---|
227 | <xsl:when test="nodeContent and not(documentNode)">
|
---|
228 | icon leafNode toggleImagePage
|
---|
229 | </xsl:when>
|
---|
230 | <xsl:otherwise>
|
---|
231 | icon toggleImageChapter
|
---|
232 | </xsl:otherwise>
|
---|
233 | </xsl:choose>
|
---|
234 | </xsl:attribute>
|
---|
235 | </div>
|
---|
236 | </td>
|
---|
237 |
|
---|
238 | <!-- The section name, links to the section in the document -->
|
---|
239 | <td>
|
---|
240 | <!-- display this item from the table of contents -->
|
---|
241 | <xsl:if test="$isCurrent"><xsl:attribute name="class">current</xsl:attribute></xsl:if>
|
---|
242 | <a>
|
---|
243 | <xsl:attribute name="href">#<xsl:value-of select="@nodeID"/></xsl:attribute>
|
---|
244 | <xsl:if test="util:hashToSectionId(@nodeID)">
|
---|
245 | <xsl:value-of select="util:hashToSectionId(@nodeID)"/>
|
---|
246 | <xsl:text> </xsl:text>
|
---|
247 | </xsl:if>
|
---|
248 | <xsl:value-of disable-output-escaping="yes" select="metadataList/metadata[@name = 'Title']"/>
|
---|
249 | </a>
|
---|
250 | </td>
|
---|
251 | </tr></table>
|
---|
252 |
|
---|
253 | <!-- display any child items -->
|
---|
254 | <xsl:if test="documentNode">
|
---|
255 | <li id="toc{@nodeID}" style="display:block;">
|
---|
256 | <xsl:apply-templates select="documentNode" mode="TOC"/>
|
---|
257 | </li>
|
---|
258 | </xsl:if>
|
---|
259 |
|
---|
260 | </ul>
|
---|
261 | </xsl:template>
|
---|
262 |
|
---|
263 | <!-- Used to produce a version of the page in a format that can be read by the realistic books plugin -->
|
---|
264 | <xsl:template match="documentNode" mode="flashxml">
|
---|
265 | <xsl:text disable-output-escaping="yes">
|
---|
266 | <Section>
|
---|
267 | <Description>
|
---|
268 | <Metadata name="Title">
|
---|
269 | </xsl:text>
|
---|
270 | <xsl:value-of select="normalize-space(metadataList/metadata[@name = 'Title'])"/>
|
---|
271 | <xsl:text disable-output-escaping="yes">
|
---|
272 | </Metadata>
|
---|
273 | </Description>
|
---|
274 | </xsl:text>
|
---|
275 |
|
---|
276 | <xsl:value-of select="normalize-space(nodeContent)" disable-output-escaping="yes"/>
|
---|
277 |
|
---|
278 | <xsl:if test="documentNode">
|
---|
279 | <xsl:apply-templates select="documentNode" mode="flashxml"/>
|
---|
280 | </xsl:if>
|
---|
281 |
|
---|
282 | <xsl:text disable-output-escaping="yes">
|
---|
283 | </Section>
|
---|
284 | </xsl:text>
|
---|
285 | </xsl:template>
|
---|
286 |
|
---|
287 | <xsl:template name="externalPage">
|
---|
288 | <xsl:param name="external"/>
|
---|
289 | <xsl:variable name="go_forward_link">
|
---|
290 | <a>
|
---|
291 | <xsl:attribute name="href">
|
---|
292 | <xsl:value-of select="$external"/>
|
---|
293 | </xsl:attribute>
|
---|
294 | <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'external.go_forward')"/>
|
---|
295 | </a>
|
---|
296 | </xsl:variable>
|
---|
297 | <h2><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'external.title')"/></h2>
|
---|
298 | <p><xsl:value-of select="util:getInterfaceTextWithDOM($interface_name, /page/@lang, 'external.text', $go_forward_link)" disable-output-escaping="yes"/></p>
|
---|
299 | </xsl:template>
|
---|
300 |
|
---|
301 | <xsl:template match="/page"><xsl:apply-templates select="/page/pageResponse/document"/></xsl:template> <!-- this to be deleted eventually -->
|
---|
302 |
|
---|
303 | <xsl:template name="viewOptions">
|
---|
304 | <table class="viewOptions"><tr>
|
---|
305 | <!-- Highlight on/off button -->
|
---|
306 | <xsl:if test="/page/pageRequest/paramList/param[@name = 'p.a']/@value = 'q'">
|
---|
307 | <td>
|
---|
308 | <a id="highlightOption">
|
---|
309 | <xsl:choose>
|
---|
310 | <xsl:when test="/page/pageRequest/paramList/param[@name = 'hl']/@value = 'on'">
|
---|
311 | <xsl:attribute name="href">
|
---|
312 | <xsl:text>javascript:removeHighlight();</xsl:text>
|
---|
313 | </xsl:attribute>
|
---|
314 | <xsl:text>No Highlighting</xsl:text>
|
---|
315 | </xsl:when>
|
---|
316 | <xsl:otherwise>
|
---|
317 | <xsl:attribute name="href">
|
---|
318 | <xsl:text>javascript:addHighlight();</xsl:text>
|
---|
319 | </xsl:attribute>
|
---|
320 | <xsl:text>Highlighting</xsl:text>
|
---|
321 | </xsl:otherwise>
|
---|
322 | </xsl:choose>
|
---|
323 | </a>
|
---|
324 | </td>
|
---|
325 | </xsl:if>
|
---|
326 |
|
---|
327 | <!-- Realistic books link -->
|
---|
328 | <xsl:if test="/page/pageResponse/collection[@name = $collName]/metadataList/metadata[@name = 'tidyoption'] = 'tidy'">
|
---|
329 | <td>
|
---|
330 | <a title="Realistic book view" href="{$library_name}?a=d&c={$collName}&d={/page/pageResponse/document/documentNode[1]/@nodeID}&dt={/page/pageResponse/document/documentNode/@docType}&p.a=b&p.s={/page/pageResponse/service/@name}&book=on&ed=1">
|
---|
331 | <img src="interfaces/oran/images/rbook.png"/>
|
---|
332 | </a>
|
---|
333 | </td>
|
---|
334 | </xsl:if>
|
---|
335 | </tr></table>
|
---|
336 | </xsl:template>
|
---|
337 | </xsl:stylesheet>
|
---|
338 |
|
---|