Mercurial > hg > mpdl-group
comparison software/eXist/webapp/mpdl/presentation/pageHtml.xsl @ 7:5589d865af7a
Erstellung XQL/XSL Applikation
author | Josef Willenborg <jwillenborg@mpiwg-berlin.mpg.de> |
---|---|
date | Tue, 08 Feb 2011 15:16:46 +0100 |
parents | |
children | d2a1c14fde31 |
comparison
equal
deleted
inserted
replaced
6:2396a569e446 | 7:5589d865af7a |
---|---|
1 <?xml version="1.0"?> | |
2 <xsl:stylesheet version="2.0" | |
3 xmlns:xsl="http://www.w3.org/1999/XSL/Transform" | |
4 xmlns:xlink="http://www.w3.org/1999/xlink" | |
5 xmlns:xs="http://www.w3.org/2001/XMLSchema" | |
6 xmlns:functx="http://www.functx.com" | |
7 xmlns:saxon="http://saxon.sf.net/" | |
8 xmlns:mpdl="http://www.mpiwg-berlin.mpg.de/ns/mpdl" | |
9 xmlns:text="http://www.mpiwg-berlin.mpg.de/ns/mpdl/text" | |
10 xmlns:mpdl-util="http://www.mpiwg-berlin.mpg.de/ns/mpdl/util" | |
11 xmlns:dc="http://purl.org/dc/elements/1.1/" | |
12 xmlns:dcterms="http://purl.org/dc/terms" | |
13 xmlns:echo="http://www.mpiwg-berlin.mpg.de/ns/echo/1.0/" | |
14 xmlns:mml="http://www.w3.org/1998/Math/MathML" | |
15 xmlns:xhtml="http://www.w3.org/1999/xhtml"> | |
16 | |
17 <xsl:import href="/db/mpdl/presentation/functions-mpdl.xsl" /> | |
18 <xsl:import href="/db/mpdl/presentation/functions-text.xsl" /> | |
19 <xsl:import href="/db/mpdl/presentation/functions-util.xsl" /> | |
20 | |
21 <xsl:output method="xhtml" encoding="utf-8"/> | |
22 | |
23 <xsl:variable name="errorMessage" select="string(/result/query/result/error)"/> | |
24 <xsl:variable name="mode" select="/result/page/mode"/> | |
25 <xsl:variable name="queryType" select="/result/query/type"/> | |
26 <xsl:variable name="query" select="text:trim(string(/result/query/expression))"/> | |
27 <xsl:variable name="queryResultPages" select="number(/result/query/result/pages)"/> | |
28 <xsl:variable name="queryResultPN" select="/result/query/result/pn"/> | |
29 <xsl:variable name="language" select="/result/document-description/language"/> | |
30 <xsl:variable name="sn" select="number(/result/page/sentence-number)"/> | |
31 <xsl:variable name="digilibAvailable" select="/result/page/digilib-available"/> | |
32 <xsl:variable name="options" select="/result/page/options"/> | |
33 <xsl:variable name="topPB" select="subsequence(//pb, 1, 1)"/> | |
34 <xsl:variable name="firstSentence" select="subsequence(//s, 1, 1)"/> | |
35 <xsl:variable name="ftQueryTermsTemp" select="string-join(text:translateLuceneToTerms($query), '')" as="xs:string"/> | |
36 <xsl:variable name="ftQueryMorphForms" select="string(/result/query/result/query-forms)"/> | |
37 <!-- Removes the duplicates between ftQueryMorphForms and ftQueryTerms for highlighting them semantically correct: --> | |
38 <!-- Morphological forms are hightlighted as whole words but query terms are highlighted also as partly strings --> | |
39 <xsl:variable name="ftQueryTerms" select="text:removeDuplicates($ftQueryTermsTemp, $ftQueryMorphForms)"/> | |
40 <xsl:variable name="ftQueryRegularizations" select="string(/result/query/result/query-regularizations)"/> | |
41 <xsl:variable name="ftQueryHighlightWords"> | |
42 <xsl:choose> | |
43 <xsl:when test="$ftQueryMorphForms != '' and $ftQueryRegularizations = ''"><xsl:value-of select="$ftQueryMorphForms"/></xsl:when> | |
44 <xsl:when test="$ftQueryMorphForms = '' and $ftQueryRegularizations != ''"><xsl:value-of select="$ftQueryRegularizations"/></xsl:when> | |
45 <xsl:when test="$ftQueryMorphForms != '' and $ftQueryRegularizations != ''"><xsl:value-of select="concat($ftQueryMorphForms, '|', $ftQueryRegularizations)"/></xsl:when> | |
46 <xsl:otherwise><xsl:value-of select="$ftQueryMorphForms"/></xsl:otherwise> | |
47 </xsl:choose> | |
48 </xsl:variable> | |
49 <!-- used in module: functions-text: highlight --> | |
50 <xsl:variable name="ftQueryEncodeBig5" select="/result/query/result/big5-mappings"/> | |
51 <xsl:variable name="ftQueryMode"> | |
52 <xsl:choose> | |
53 <xsl:when test="matches($query, concat('"', '.*', '"'))"> | |
54 <xsl:value-of select="'phrase'"/> | |
55 </xsl:when> | |
56 <xsl:when test="string-length($query) = 0"> | |
57 <xsl:value-of select="'false'"/> | |
58 </xsl:when> | |
59 <!-- Because there are problems in recognizing words (in mode word) this fake mode is used (same as phrase mode) --> | |
60 <xsl:otherwise><xsl:value-of select="'fakeWord'"/></xsl:otherwise> | |
61 </xsl:choose> | |
62 </xsl:variable> | |
63 | |
64 <xsl:template match="result"> | |
65 <xsl:variable name="author" select="string-join(/result/document-description/authors/author, ', ')"/> | |
66 <xsl:variable name="title" select="string-join(/result/document-description/titles/title, ', ')"/> | |
67 <xsl:variable name="place" select="string-join(/result/document-description/places/place, ', ')"/> | |
68 <xsl:variable name="date" select="/result/document-description/date"/> | |
69 <xsl:variable name="bookTitle"> | |
70 <xsl:value-of select="$author"/>. | |
71 <xsl:value-of select="$title"/>. | |
72 <xsl:value-of select="$place"/><xsl:if test="$place != ''">, </xsl:if> | |
73 <xsl:value-of select="$date"/>. | |
74 </xsl:variable> | |
75 <html> | |
76 <head> | |
77 <title><xsl:value-of select="$bookTitle"/></title> | |
78 <link rel="stylesheet" type="text/css" href="presentation/pageHtml.css"/> | |
79 </head> | |
80 <body> | |
81 <text style="font-weight:bold;font-size:20px"><xsl:value-of select="$bookTitle"/></text> | |
82 <p/> | |
83 <xsl:for-each select="page"> | |
84 <xsl:variable name="documentUri" select="/result/document-description/uri"/> | |
85 <xsl:variable name="documentName" select="/result/document-description/document-name"/> | |
86 <xsl:variable name="countPages" select="/result/document-description/count-pages"/> | |
87 <xsl:variable name="pageHeader" select="header"/> | |
88 <xsl:variable name="pageNumber" select="number(number)"/> | |
89 <xsl:variable name="pageNumberOrig" select="number-orig"/> | |
90 <xsl:variable name="documentValue" select="concat('document=', $documentUri)"/> | |
91 <xsl:variable name="pnValue" select="concat('pn=', $pageNumber)"/> | |
92 <xsl:variable name="modeValue" select="concat('mode=', $mode)"/> | |
93 <table cellspacing="1" cellpadding="1"> | |
94 <colgroup> | |
95 <col width="5%"/> | |
96 <col width="5%"/> | |
97 <col width="5%"/> | |
98 <col width="5%"/> | |
99 <col width="33%"/> | |
100 <col width="3%"/> | |
101 <col width="3%"/> | |
102 <col width="3%"/> | |
103 <col width="3%"/> | |
104 <col width="3%"/> | |
105 <col width="3%"/> | |
106 <col width="3%"/> | |
107 <col width="10%"/> | |
108 <col width="3%"/> | |
109 <col width="5%"/> | |
110 <col width="3%"/> | |
111 <col width="5%"/> | |
112 </colgroup> | |
113 <tr> | |
114 <form action="page-query-result.xql" method="get"> | |
115 <input type="hidden" name="document" value="{$documentUri}"/> | |
116 <td> | |
117 <xsl:choose> | |
118 <xsl:when test="$mode = 'text'"><button id="buttonModeText" name="mode" value="text" style="background:none;border:none;"><img src="images/text.jpg" height="18"/></button></xsl:when> | |
119 <xsl:otherwise><button id="buttonModeUText" name="mode" value="text" style="background:none;border:none;"><img src="images/textU.jpg" height="18"/></button></xsl:otherwise> | |
120 </xsl:choose> | |
121 </td> | |
122 <td> | |
123 <xsl:choose> | |
124 <xsl:when test="$mode = 'textPollux'"><button id="buttonModeTextPollux" name="mode" value="textPollux" style="background:none;border:none;"><img src="images/textPollux.jpg" height="18"/></button></xsl:when> | |
125 <xsl:otherwise><button id="buttonModeUTextPollux" name="mode" value="textPollux" style="background:none;border:none;"><img src="images/textPolluxU.jpg" height="18"/></button></xsl:otherwise> | |
126 </xsl:choose> | |
127 </td> | |
128 <td> | |
129 <xsl:choose> | |
130 <xsl:when test="$mode = 'image'"><button id="buttonModeImage" name="mode" value="image" style="background:none;border:none;"><img src="images/image.jpg" height="18"/></button></xsl:when> | |
131 <xsl:otherwise><button id="buttonModeUImage" name="mode" value="image" style="background: none;border:none;"><img src="images/imageU.jpg" height="18"/></button></xsl:otherwise> | |
132 </xsl:choose> | |
133 </td> | |
134 <td> | |
135 <xsl:choose> | |
136 <xsl:when test="$mode = 'xml'"><button id="buttonModeXml" name="mode" value="xml" style="background:none;border:none;"><img src="images/xml.jpg" height="18"/></button></xsl:when> | |
137 <xsl:otherwise><button id="buttonModeUXml" name="mode" value="xml" style="background:none;border:none;"><img src="images/xmlU.jpg" height="18"/></button></xsl:otherwise> | |
138 </xsl:choose> | |
139 </td> | |
140 <input type="hidden" name="pn" value="{$pageNumber}"/> | |
141 <xsl:if test="/result/page/sentence-number[node()]"> | |
142 <input type="hidden" name="sn" value="{$sn}"/> | |
143 </xsl:if> | |
144 <input type="hidden" name="query-type" value="{$queryType}"/> | |
145 <xsl:if test="/result/query/result[node()]"> | |
146 <input type="hidden" name="query" value="{$query}"/> | |
147 <input type="hidden" name="query-result-pn" value="{$queryResultPN}"/> | |
148 </xsl:if> | |
149 </form> | |
150 <td/> | |
151 <!-- toc, fulltext, fulltextMorph, structural, ftIndex and ftIndexMorph buttons --> | |
152 <form action="page-query-result.xql" method="get"> | |
153 <input type="hidden" name="document" value="{$documentUri}"/> | |
154 <input type="hidden" name="mode" value="{$mode}"/> | |
155 <input type="hidden" name="pn" value="{$pageNumber}"/> | |
156 <xsl:if test="/result/page/sentence-number[node()]"> | |
157 <input type="hidden" name="sn" value="-1"/> | |
158 </xsl:if> | |
159 <td><button id="bToc" name="query-type" value="toc" style="background: none; border: none;"><img src="images/toc.gif" width="24" height="24"/></button></td> | |
160 <td><button id="bFulltext" name="query-type" value="fulltext" style="background: none; border: none;"><img src="images/search.gif" width="24" height="24"/></button></td> | |
161 <td><button id="bFulltextMorph" name="query-type" value="fulltextMorph" style="background: none; border: none;"><img src="images/searchMorph.gif" width="24" height="24"/></button></td> | |
162 <td><button id="bStructural" name="query-type" value="xpath" style="background: none; border: none;"><img src="images/searchStructural.gif" width="24" height="24"/></button></td> | |
163 <td><button id="bFtIndex" name="query-type" value="ftIndex" style="background: none; border: none;"><img src="images/dictionary.gif" width="24" height="24"/></button></td> | |
164 <td><button id="bftIndexMorph" name="query-type" value="ftIndexMorph" style="background: none; border: none;"><img src="images/dictionaryMorph.gif" width="24" height="24"/></button></td> | |
165 <td><button id="bFigures" name="query-type" value="figures" style="background: none; border: none;"><img src="images/figures.png" width="24" height="24"/></button></td> | |
166 <xsl:choose> | |
167 <xsl:when test="/result/query/result[node()] and not($queryType = 'toc')"> | |
168 <input type="hidden" name="query" value=""/> | |
169 <input type="hidden" name="query-result-pn" value="{$queryResultPN}"/> | |
170 </xsl:when> | |
171 <xsl:when test="/result/query/result[node()] and $queryType = 'toc'"> | |
172 <input type="hidden" name="query-result-pn" value="1"/> | |
173 </xsl:when> | |
174 <xsl:otherwise> | |
175 </xsl:otherwise> | |
176 </xsl:choose> | |
177 </form> | |
178 <td/> | |
179 <xsl:variable name="leftNumber"> | |
180 <xsl:choose> | |
181 <xsl:when test="$pageNumber > 1"><xsl:value-of select="$pageNumber - 1"/></xsl:when> | |
182 <xsl:otherwise><xsl:value-of select="$pageNumber"/></xsl:otherwise> | |
183 </xsl:choose> | |
184 </xsl:variable> | |
185 <xsl:variable name="rightNumber"> | |
186 <xsl:choose> | |
187 <xsl:when test="$pageNumber < $countPages"><xsl:value-of select="$pageNumber + 1"/></xsl:when> | |
188 <xsl:otherwise><xsl:value-of select="$pageNumber"/></xsl:otherwise> | |
189 </xsl:choose> | |
190 </xsl:variable> | |
191 <form action="page-query-result.xql" method="get"> | |
192 <input type="hidden" name="document" value="{$documentUri}"/> | |
193 <input type="hidden" name="mode" value="{$mode}"/> | |
194 <td><button id="buttonLeftNumber" name="pn" value="{$leftNumber}" style="background:none;border:none;"><img src="images/left.gif"/></button></td> | |
195 <td nowrap="true"><xsl:value-of select="$pageNumber"/> / <xsl:value-of select="$countPages"/></td> | |
196 <td><button id="buttonRightNumber" name="pn" value="{$rightNumber}" style="background:none;border:none;"><img src="images/right.gif"/></button></td> | |
197 <input type="hidden" name="query-type" value="{$queryType}"/> | |
198 <xsl:if test="/result/query/result[node()]"> | |
199 <input type="hidden" name="query" value="{$query}"/> | |
200 <input type="hidden" name="query-result-pn" value="{$queryResultPN}"/> | |
201 </xsl:if> | |
202 </form> | |
203 <form action="page-query-result.xql" method="get"> | |
204 <input type="hidden" name="document" value="{$documentUri}"/> | |
205 <input type="hidden" name="mode" value="{$mode}"/> | |
206 <td nowrap="true">Page: <input type="text" size="2" name="pn" value="{$pageNumber}"/></td> | |
207 <input type="hidden" name="query-type" value="{$queryType}"/> | |
208 <xsl:if test="/result/query/result[node()]"> | |
209 <input type="hidden" name="query" value="{$query}"/> | |
210 <input type="hidden" name="query-result-pn" value="{$queryResultPN}"/> | |
211 </xsl:if> | |
212 </form> | |
213 </tr> | |
214 </table> | |
215 <hr/> | |
216 <table align="middle" width="100%" rules="cols" frame="void" cellpadding="7"> | |
217 <colgroup> | |
218 <col width="65%"/> | |
219 <col width="35%"/> | |
220 </colgroup> | |
221 <tr> | |
222 <xsl:for-each select="content"> | |
223 <xsl:choose> | |
224 <xsl:when test="$mode = 'text' or $mode = 'textPollux' or $mode = 'gis'"> | |
225 <td align="left" valign="top"> | |
226 <xsl:if test="$pageHeader != '' or $pageNumberOrig != ''"> | |
227 <table width="100%" cellspacing="1" cellpadding="1"> | |
228 <colgroup> | |
229 <col width="10%"/> | |
230 <col width="70%"/> | |
231 <col width="20%"/> | |
232 </colgroup> | |
233 <tr> | |
234 <td align="left"><b><xsl:value-of select="$pageNumberOrig"/></b></td> | |
235 <td align="center"><b><xsl:value-of select="$pageHeader"/></b></td> | |
236 </tr> | |
237 </table> | |
238 </xsl:if> | |
239 <table> | |
240 <colgroup> | |
241 <col width="90%"/> | |
242 <col width="10%"/> | |
243 </colgroup> | |
244 <tr> | |
245 <td> | |
246 <xsl:variable name="contentStr" select="normalize-space(string(.))"/> | |
247 <xsl:variable name="figures" select=".//figure|.//handwritten"/> | |
248 <xsl:if test="$contentStr = '' and empty($figures)"> | |
249 <div class="emptyPage"><xsl:value-of select="'[Empty page]'"/></div> | |
250 </xsl:if> | |
251 <xsl:apply-templates mode="text"/> | |
252 </td> | |
253 <td align="middle" valign="top"><p><a href="?{$documentValue}&mode={$mode}&pn={$pageNumber}&sn={$sn}&export=pdf&options={$options}"><img src="images/download.png" width="24" height="24" border="0" alt="Download"/></a><br/>Download PDF</p></td> | |
254 </tr> | |
255 </table> | |
256 </td> | |
257 </xsl:when> | |
258 <xsl:when test="$mode = 'xml'"> | |
259 <td align="left" valign="top"> | |
260 <table> | |
261 <colgroup> | |
262 <col width="90%"/> | |
263 <col width="10%"/> | |
264 </colgroup> | |
265 <tr> | |
266 <td><xsl:apply-templates mode="xml"/></td> | |
267 <td align="middle" valign="top"><p><a target="_blank" href="?{$documentValue}&mode=pureXml&pn={$pageNumber}"><img src="images/download.png" width="24" height="24" border="0" alt="Download"/></a><br/>Download XML</p></td> | |
268 <td align="middle" valign="top"><p><a href="?{$documentValue}&mode={$mode}&pn={$pageNumber}&sn={$sn}&export=pdf"><img src="images/download.png" width="24" height="24" border="0" alt="Download"/></a><br/>Download PDF</p></td> | |
269 </tr> | |
270 </table> | |
271 </td> | |
272 </xsl:when> | |
273 <xsl:when test="$mode = 'image'"> | |
274 <xsl:variable name="imageAvailable" select="/result/page/image-available"/> | |
275 <xsl:variable name="imageFileName" select="/result/page/image-file-name"/> | |
276 <xsl:variable name="linkImageEcho" select="/result/page/image-echo"/> | |
277 <xsl:variable name="linkImageScaler" select="/result/page/image-scaler"/> | |
278 <xsl:variable name="imageHeight" select="600"/> | |
279 <td align="middle" valign="top"> | |
280 <xsl:choose> | |
281 <xsl:when test="$digilibAvailable = 'true' and $imageAvailable = 'true'"> | |
282 <table> | |
283 <colgroup> | |
284 <col width="90%"/> | |
285 <col width="10%"/> | |
286 </colgroup> | |
287 <tr> | |
288 <td> | |
289 <div style="height:{$imageHeight}px; margin-left:10px; margin-right:10px; border: 1px;"> | |
290 <a href="{$linkImageEcho}"><img alt="Page image: {$linkImageScaler}" src="{$linkImageScaler}&dh={$imageHeight}"/></a> | |
291 </div> | |
292 </td> | |
293 <td align="middle" valign="top"><p><a href="?{$documentValue}&mode={$mode}&pn={$pageNumber}&sn={$sn}&export=pdf"><img src="images/download.png" width="24" height="24" border="0" alt="Download"/></a><br/>Download PDF</p></td> | |
294 </tr> | |
295 </table> | |
296 </xsl:when> | |
297 <xsl:when test="$digilibAvailable = 'true' and $imageAvailable = 'false'"> | |
298 <div style="height:{$imageHeight}px; margin-left:10px; margin-right:10px; border:1px dashed;"> | |
299 <br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/> | |
300 Page image: <br/> | |
301 <br/> | |
302 <xsl:value-of select="$imageFileName"/> , page <xsl:value-of select="$pageNumber"/> | |
303 <br/><br/> | |
304 not scanned | |
305 </div> | |
306 </xsl:when> | |
307 <xsl:when test="$digilibAvailable = 'false'"> | |
308 <div style="height:{$imageHeight}px; margin-left:10px; margin-right:10px; border:1px dashed;"> | |
309 <br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/> | |
310 Could not fetch: <br/> | |
311 <br/> | |
312 <xsl:value-of select="$imageFileName"/> , page <xsl:value-of select="$pageNumber"/> | |
313 <br/><br/> | |
314 from nausikaa2.rz-berlin.mpg.de: please try again later | |
315 </div> | |
316 </xsl:when> | |
317 <xsl:otherwise></xsl:otherwise> | |
318 </xsl:choose> | |
319 </td> | |
320 </xsl:when> | |
321 <xsl:otherwise></xsl:otherwise> | |
322 </xsl:choose> | |
323 </xsl:for-each> | |
324 <td align="left" valign="top" style="padding-right: 25px;"> | |
325 <xsl:if test="$queryType = 'toc'"> | |
326 <b>Table of contents</b> | |
327 </xsl:if> | |
328 <xsl:if test="$queryType = 'figures'"> | |
329 <b>Figures</b> | |
330 </xsl:if> | |
331 <xsl:if test="$queryType = 'fulltext' or $queryType = 'fulltextMorph' or $queryType = 'fulltextMorphLemma'"> | |
332 <form action="page-query-result.xql" method="get"> | |
333 <input type="hidden" name="document" value="{$documentUri}"/> | |
334 <input type="hidden" name="pn" value="{$pageNumber}"/> | |
335 <input type="hidden" name="mode" value="{$mode}"/> | |
336 <input type="hidden" name="query-type" value="{$queryType}"/> | |
337 <xsl:if test="$queryType = 'fulltext'"> | |
338 <xsl:value-of select="'Contains: '"/> | |
339 </xsl:if> | |
340 <xsl:if test="$queryType = 'fulltextMorph'"> | |
341 <xsl:value-of select="'Contains morphological: '"/> | |
342 </xsl:if> | |
343 <xsl:if test="$queryType = 'fulltextMorphLemma'"> | |
344 <xsl:value-of select="'Contains lemma: '"/> | |
345 </xsl:if> | |
346 <input type="text" size="15" name="query" value="{$query}"/> | |
347 <input type="hidden" name="query-result-pn" value="1"/> | |
348 <input type="submit" value="Query"/> | |
349 </form> | |
350 </xsl:if> | |
351 <xsl:if test="$queryType = 'xpath' or $queryType = 'xquery'"> | |
352 <form action="page-query-result.xql" method="get"> | |
353 <input type="hidden" name="document" value="{$documentUri}"/> | |
354 <input type="hidden" name="pn" value="{$pageNumber}"/> | |
355 <input type="hidden" name="mode" value="{$mode}"/> | |
356 <table cellspacing="1" cellpadding="1"> | |
357 <colgroup> | |
358 <col width="70%"/> | |
359 <col width="15%"/> | |
360 <col width="15%"/> | |
361 </colgroup> | |
362 <tr> | |
363 <td> | |
364 <xsl:if test="$queryType = 'xpath'"><b><xsl:value-of select="'XPath query '"/></b></xsl:if> | |
365 <xsl:if test="$queryType = 'xquery'"><b><xsl:value-of select="'XQuery '"/></b></xsl:if> | |
366 <a href="info.xql?info={$queryType}" onclick="window.open("info.xql?info={$queryType}", "InfoWindow", "menubar=no,width=500,height=500,toolbar=no");return false"><img src="images/info.png" width="15" height="15" border="0" alt="Info"/></a> | |
367 </td> | |
368 <td><button id="bXPath" name="query-type" value="xpath" style="background:none"><text style="font-weight:bold;font-size:12px">XPath</text></button></td> | |
369 <td><button id="bXQuery" name="query-type" value="xquery" style="background:none"><text style="font-weight:bold;font-size:12px">XQuery</text></button></td> | |
370 </tr> | |
371 </table> | |
372 <input type="hidden" name="query" value=""/> | |
373 </form> | |
374 <form action="page-query-result.xql" method="get"> | |
375 <input type="hidden" name="document" value="{$documentUri}"/> | |
376 <input type="hidden" name="pn" value="{$pageNumber}"/> | |
377 <input type="hidden" name="mode" value="{$mode}"/> | |
378 <xsl:if test="$queryType = 'xpath'"> | |
379 <input type="hidden" name="query-type" value="xpath"/> | |
380 <table> | |
381 <tr><td><input type="text" size="50" name="query" value="{$query}"/></td></tr> | |
382 <tr><td><input type="submit" value="Query"/></td></tr> | |
383 </table> | |
384 </xsl:if> | |
385 <xsl:if test="$queryType = 'xquery'"> | |
386 <input type="hidden" name="query-type" value="xquery"/> | |
387 <table> | |
388 <tr> | |
389 <td> | |
390 <textarea name="query" cols="45" rows="10"> | |
391 <xsl:choose> | |
392 <xsl:when test="$query = ''"><xsl:value-of select="' '" /></xsl:when> | |
393 <xsl:otherwise><xsl:value-of select="$query"/></xsl:otherwise> | |
394 </xsl:choose> | |
395 </textarea> | |
396 </td> | |
397 </tr> | |
398 <tr><td><input type="submit" value="Query"/></td></tr> | |
399 </table> | |
400 </xsl:if> | |
401 </form> | |
402 </xsl:if> | |
403 <xsl:if test="$queryType = 'ftIndex' or $queryType = 'ftIndexMorph'"> | |
404 <form action="page-query-result.xql" method="get"> | |
405 <input type="hidden" name="document" value="{$documentUri}"/> | |
406 <input type="hidden" name="pn" value="{$pageNumber}"/> | |
407 <input type="hidden" name="mode" value="{$mode}"/> | |
408 <input type="hidden" name="query-type" value="{$queryType}"/> | |
409 <xsl:if test="$queryType = 'ftIndex'"><xsl:value-of select="'Fulltext index: '"/></xsl:if> | |
410 <xsl:if test="$queryType = 'ftIndexMorph'"><xsl:value-of select="'Morphological index: '"/></xsl:if> | |
411 <input type="text" size="10" name="query" value="{$query}"/> | |
412 <input type="hidden" name="query-result-pn" value="1"/> | |
413 <input type="submit" value="Query"/> | |
414 </form> | |
415 </xsl:if> | |
416 <xsl:if test="(($query != '' or $queryType = 'toc' or $queryType = 'figures') and $queryResultPages > 0)"> | |
417 <hr/> | |
418 <table> | |
419 <colgroup> | |
420 <col width="81%"/> | |
421 <col width="3%"/> | |
422 <col width="5%"/> | |
423 <col width="3%"/> | |
424 <col width="5%"/> | |
425 </colgroup> | |
426 <tr> | |
427 <td> | |
428 <xsl:variable name="resultSize" select="/result/query/result/size"/> | |
429 <xsl:if test="$queryType = 'fulltext' or $queryType = 'fulltextMorph' or $queryType = 'fulltextMorphLemma'"> | |
430 <b><xsl:value-of select="$resultSize"/> sentence hits</b> | |
431 </xsl:if> | |
432 <xsl:if test="$queryType = 'ftIndex' or $queryType = 'ftIndexMorph'"> | |
433 <b><xsl:value-of select="$resultSize"/> entries beginning with: "<xsl:value-of select="$query"/>"<br/></b> | |
434 </xsl:if> | |
435 <xsl:if test="$queryType = 'xpath' or $queryType = 'xquery'"> | |
436 <b><xsl:value-of select="$resultSize"/> element hits</b> | |
437 </xsl:if> | |
438 </td> | |
439 <xsl:variable name="leftNumber"> | |
440 <xsl:choose> | |
441 <xsl:when test="$queryResultPN > 1"><xsl:value-of select="$queryResultPN - 1"/></xsl:when> | |
442 <xsl:otherwise><xsl:value-of select="$queryResultPN"/></xsl:otherwise> | |
443 </xsl:choose> | |
444 </xsl:variable> | |
445 <xsl:variable name="rightNumber"> | |
446 <xsl:choose> | |
447 <xsl:when test="$queryResultPN < $queryResultPages"><xsl:value-of select="$queryResultPN + 1"/></xsl:when> | |
448 <xsl:otherwise><xsl:value-of select="$queryResultPN"/></xsl:otherwise> | |
449 </xsl:choose> | |
450 </xsl:variable> | |
451 <form action="page-query-result.xql" method="get"> | |
452 <input type="hidden" name="document" value="{$documentUri}"/> | |
453 <input type="hidden" name="pn" value="{$pageNumber}"/> | |
454 <input type="hidden" name="mode" value="{$mode}"/> | |
455 <input type="hidden" name="query-type" value="{$queryType}"/> | |
456 <input type="hidden" name="query" value="{$query}"/> | |
457 <td><button id="buttonLeftNumber" name="query-result-pn" value="{$leftNumber}" style="background:none;border:none;"><img src="images/left.gif"/></button></td> | |
458 <td nowrap="true"><xsl:value-of select="$queryResultPN"/> / <xsl:value-of select="$queryResultPages"/></td> | |
459 <td><button id="buttonRightNumber" name="query-result-pn" value="{$rightNumber}" style="background:none;border:none;"><img src="images/right.gif"/></button></td> | |
460 </form> | |
461 <form action="page-query-result.xql" method="get"> | |
462 <input type="hidden" name="document" value="{$documentUri}"/> | |
463 <input type="hidden" name="pn" value="{$pageNumber}"/> | |
464 <input type="hidden" name="mode" value="{$mode}"/> | |
465 <input type="hidden" name="query-type" value="{$queryType}"/> | |
466 <input type="hidden" name="query" value="{$query}"/> | |
467 <td nowrap="true">Page: <input type="text" size="2" name="query-result-pn" value="{$queryResultPN}"/></td> | |
468 </form> | |
469 </tr> | |
470 </table> | |
471 <xsl:if test="$ftQueryMorphForms != ''"> | |
472 <table> | |
473 <colgroup> | |
474 <col width="40%"/> | |
475 <col width="60%"/> | |
476 </colgroup> | |
477 <td/> | |
478 <xsl:if test="$queryType = 'fulltextMorph'"> | |
479 <td align="right" nowrap="true">Morphological expansion: <a href="lt/lemma.xql?language={$language}&query={$query}">see here</a></td> | |
480 </xsl:if> | |
481 <xsl:if test="$queryType = 'fulltextMorphLemma'"> | |
482 <td align="right" nowrap="true">Morphological expansion: <a href="lt/lemma.xql?language={$language}&lemma={$query}">see here</a></td> | |
483 </xsl:if> | |
484 </table> | |
485 </xsl:if> | |
486 <hr/> | |
487 <xsl:if test="$queryType = 'toc' or $queryType = 'figures'"> | |
488 <table class="toc" cellspacing="1" cellpadding="1"> | |
489 <colgroup> | |
490 <col width="70%"/> | |
491 <col width="20%"/> | |
492 </colgroup> | |
493 <xsl:for-each select="/result/query/result/hits/toc-entry"> | |
494 <xsl:variable name="page" select="page"/> | |
495 <xsl:variable name="level"> | |
496 <xsl:choose> | |
497 <xsl:when test="real-level = '1'"><xsl:value-of select="'one'"/></xsl:when> | |
498 <xsl:when test="real-level = '2'"><xsl:value-of select="'two'"/></xsl:when> | |
499 <xsl:when test="real-level = '3'"><xsl:value-of select="'three'"/></xsl:when> | |
500 <xsl:when test="real-level = '4'"><xsl:value-of select="'four'"/></xsl:when> | |
501 <xsl:when test="real-level = '5'"><xsl:value-of select="'five'"/></xsl:when> | |
502 <xsl:when test="real-level = '6'"><xsl:value-of select="'six'"/></xsl:when> | |
503 <xsl:when test="real-level = '7'"><xsl:value-of select="'seven'"/></xsl:when> | |
504 <xsl:otherwise><xsl:value-of select="'one'"/></xsl:otherwise> | |
505 </xsl:choose> | |
506 </xsl:variable> | |
507 <tr> | |
508 <td align="left" valign="top"> | |
509 <div class="toc {$level}"> | |
510 <xsl:value-of select="'['"/> | |
511 <xsl:value-of select="concat(level-string, ' ')"/> | |
512 <xsl:value-of select="content"/> | |
513 <xsl:value-of select="']'"/> | |
514 </div> | |
515 </td> | |
516 <td align="center" valign="top"> | |
517 <div class="toc float right"> | |
518 <a href="?{$documentValue}&pn={$page}&{$modeValue}&query-type={$queryType}&query-result-pn={$queryResultPN}"> | |
519 <xsl:value-of select="concat('Page: ', $page)"/> | |
520 </a> | |
521 </div> | |
522 </td> | |
523 </tr> | |
524 </xsl:for-each> | |
525 </table> | |
526 </xsl:if> | |
527 <xsl:if test="$queryType = 'fulltext' or $queryType = 'fulltextMorph' or $queryType = 'fulltextMorphLemma'"> | |
528 <table cellspacing="1" cellpadding="1"> | |
529 <xsl:for-each select="/result/query/result/hits/hit"> | |
530 <tr valign="top"> | |
531 <xsl:variable name="pos" select="pos"/> | |
532 <xsl:variable name="term" select="term"/> | |
533 <td><xsl:value-of select="$pos"/>.</td> | |
534 <td align="left"> | |
535 <xsl:variable name="hitPN" select="pn"/> | |
536 <xsl:variable name="hitPosOfS" select="pos-of-s"/> | |
537 <xsl:variable name="sSurroundsPB" select="s-surrounds-pb"/> | |
538 <xsl:variable name="queryValue" select="concat('&', 'query=', $query)"/> | |
539 <xsl:variable name="queryValueEscaped1" select="replace($queryValue, '\+', '%2B')"/> | |
540 <xsl:variable name="queryValueEscaped2" select="replace($queryValueEscaped1, ' ', '+')"/> | |
541 <xsl:choose> | |
542 <!-- if a found sentence surrounds a page break then a special presentation of the hit is done --> | |
543 <xsl:when test="$sSurroundsPB = 'false'"> | |
544 <a href="?{$documentValue}&pn={$hitPN}&sn={$hitPosOfS}&{$modeValue}&query-type={$queryType}{$queryValueEscaped2}&query-result-pn={$queryResultPN}#sn{$hitPosOfS}">Page <xsl:value-of select="$hitPN"/>, Sentence <xsl:value-of select="$hitPosOfS"/></a> | |
545 </xsl:when> | |
546 <xsl:otherwise> | |
547 <a href="?{$documentValue}&pn={$hitPN}&sn={$hitPosOfS}&{$modeValue}&query-type={$queryType}{$queryValueEscaped2}&query-result-pn={$queryResultPN}#sn{$hitPosOfS}">Page <xsl:value-of select="$hitPN"/>, Sentence <xsl:value-of select="$hitPosOfS"/></a> / <a href="?{$documentValue}&pn={$hitPN + 1}&sn=0&{$modeValue}&query-type={$queryType}{$queryValueEscaped2}&query-result-pn={$queryResultPN}#sn0">Page <xsl:value-of select="$hitPN + 1"/>, continuation of the sentence</a> | |
548 </xsl:otherwise> | |
549 </xsl:choose> | |
550 :<br/> | |
551 <!-- Highlight the query terms in each hit sentence and clip the result --> | |
552 <xsl:sequence select="text:highlight(s, $ftQueryTerms, $ftQueryHighlightWords, 'true')"/> | |
553 </td> | |
554 </tr> | |
555 </xsl:for-each> | |
556 </table> | |
557 </xsl:if> | |
558 <xsl:if test="$queryType = 'ftIndex' or $queryType = 'ftIndexMorph'"> | |
559 <table cellspacing="1" cellpadding="1"> | |
560 <xsl:for-each select="/result/query/result/hits/entry"> | |
561 <tr valign="top"> | |
562 <xsl:variable name="pos" select="position"/> | |
563 <xsl:variable name="term" select="term"/> | |
564 <xsl:variable name="polluxKeys" select="pollux-keys"/> | |
565 <xsl:variable name="lemmasWithOR" select="lemmas-with-or"/> | |
566 <xsl:variable name="dictionaryLink"> | |
567 <xsl:choose> | |
568 <xsl:when test="$language = 'zh'"> | |
569 <xsl:variable name="termBig5Encoded" select="/result/query/result/big5-hits/entry-big5-encoded/term[$pos]"/> | |
570 <a href="http://humanum.arts.cuhk.edu.hk/cgi-bin/agrep-lindict?query={$termBig5Encoded}&category=wholerecord">Lin Yutang</a> | |
571 <!-- TODO: replace Java based function by XSL-function like the following, but that does not work yet cause termHexBin is not the same than by Java) also in query.xsl and functions-text.xsl --> | |
572 <xsl:variable name="termHexBin"><xsl:value-of select="saxon:string-to-hexBinary($term, 'utf8')"/></xsl:variable> | |
573 <xsl:variable name="termHexBinStr" select="string($termHexBin)"/> | |
574 <xsl:variable name="termBig5EncodedNew"> | |
575 <xsl:for-each select="string-to-codepoints($termHexBinStr)"> | |
576 <xsl:variable name="pos" select="position()"/> | |
577 <xsl:variable name="posIDiv" select="$pos idiv 2"/> | |
578 <xsl:variable name="posPlus1IDiv" select="($pos + 1) idiv 2"/> | |
579 <xsl:if test="$posIDiv != $posPlus1IDiv"> | |
580 <xsl:variable name="charStr" select="substring($termHexBinStr, $pos, 2)"/> | |
581 <xsl:value-of select="encode-for-uri(concat('%', $charStr))"/> | |
582 </xsl:if> | |
583 </xsl:for-each> | |
584 </xsl:variable> | |
585 </xsl:when> | |
586 <xsl:otherwise><a href="http://archimedes.mpiwg-berlin.mpg.de/cgi-bin/toc/dict?step=table;word={$term};lang={$language};pro=echo">Echo</a></xsl:otherwise> | |
587 </xsl:choose> | |
588 </xsl:variable> | |
589 <xsl:variable name="polluxLink"> | |
590 <xsl:choose> | |
591 <xsl:when test="$polluxKeys = ''">Pollux</xsl:when> | |
592 <xsl:otherwise><a href="lt/lex.xql?language={$language}&query={$polluxKeys}">Pollux</a></xsl:otherwise> | |
593 </xsl:choose> | |
594 </xsl:variable> | |
595 <xsl:variable name="wikipediaLink"> | |
596 <xsl:choose> | |
597 <xsl:when test="$lemmasWithOR = ''">Wiki</xsl:when> | |
598 <xsl:otherwise><a href="http://{$language}.wikipedia.org/wiki/index.php?search={$lemmasWithOR}">Wiki</a></xsl:otherwise> | |
599 </xsl:choose> | |
600 </xsl:variable> | |
601 <xsl:variable name="ftSearchQueryType"> | |
602 <xsl:choose> | |
603 <xsl:when test="$queryType = 'ftIndex'"><xsl:value-of select="'fulltext'"/></xsl:when> | |
604 <xsl:when test="$queryType = 'ftIndexMorph'"><xsl:value-of select="'fulltextMorphLemma'"/></xsl:when> | |
605 <xsl:otherwise></xsl:otherwise> | |
606 </xsl:choose> | |
607 </xsl:variable> | |
608 <td><xsl:value-of select="$pos"/>.</td> | |
609 <td align="left"> | |
610 <a href="lt/lemma.xql?language={$language}&lemma={$term}"><xsl:value-of select="$term"/></a>(<a href="?{$documentValue}&{$modeValue}&query-type={$ftSearchQueryType}&query={$term}"><xsl:value-of select="frequency"/></a>) [<xsl:sequence select="$polluxLink"/>][<xsl:sequence select="$wikipediaLink"/>][<xsl:sequence select="$dictionaryLink"/>] | |
611 </td> | |
612 </tr> | |
613 </xsl:for-each> | |
614 </table> | |
615 </xsl:if> | |
616 <xsl:if test="$queryType = 'xpath' or $queryType = 'xquery'"> | |
617 <xsl:for-each select="/result/query/result/hits"> | |
618 <table> | |
619 <colgroup> | |
620 <col width="90%"/> | |
621 <col width="10%"/> | |
622 </colgroup> | |
623 <tr> | |
624 <td><xsl:apply-templates mode="xml"/></td> | |
625 <xsl:variable name="queryWithoutCRLF" select="replace($query, '\r\n', ' ')"/> | |
626 <td align="middle" valign="top"><p><a target="_blank" href="?{$documentValue}&mode=pureXml&query-type={$queryType}&query={$queryWithoutCRLF}&query-result-pn={$queryResultPN}"><img src="images/download.png" width="24" height="24" border="0" alt="Download"/></a><br/>Download</p></td> | |
627 </tr> | |
628 </table> | |
629 </xsl:for-each> | |
630 </xsl:if> | |
631 </xsl:if> | |
632 <xsl:choose> | |
633 <xsl:when test="$errorMessage != ''"> | |
634 <hr/> | |
635 <b>Your query delivers an error: </b> | |
636 <xsl:value-of select="$errorMessage"/> | |
637 </xsl:when> | |
638 <xsl:when test="$errorMessage = '' and $query != '' and $queryResultPages = 0"> | |
639 <hr/> | |
640 <b>No results</b> | |
641 </xsl:when> | |
642 </xsl:choose> | |
643 </td> | |
644 </tr> | |
645 </table> | |
646 <hr/> | |
647 Elapsed time: <xsl:value-of select="/result/performance"/> ms, Back to <a href="query.xql">query page</a>, see the <a href="page-query-result.xql?_source=yes">XQuery source</a> and <a href="/exist/rest/db/mpdl/presentation/pageHtml.xsl?_source=yes">XSL source</a> of this page | |
648 <br/> | |
649 </xsl:for-each> | |
650 </body></html> | |
651 </xsl:template> | |
652 | |
653 <xsl:template match="attribute()|element()|text()|comment()|processing-instruction()" mode="xml"> | |
654 <xsl:copy> | |
655 <xsl:apply-templates select="attribute()|element()|text()|comment()|processing-instruction()"/> | |
656 </xsl:copy> | |
657 </xsl:template> | |
658 | |
659 <xsl:template match="element()|comment()|processing-instruction()" mode="xml"> | |
660 <xsl:variable name="elementName" select="name()"/> | |
661 <xsl:variable name="elementPresentation"> | |
662 <xsl:choose> | |
663 <xsl:when test="element() = node() or text() != '' or self::comment() or self::processing-instruction()"> | |
664 <xsl:value-of select="'<'"/> | |
665 <span class="xml elementName"><xsl:value-of select="$elementName"/></span> | |
666 <xsl:apply-templates select="attribute()" mode="xml"/> | |
667 <xsl:value-of select="'>'"/> | |
668 <xsl:apply-templates select="element()|text()|comment()|processing-instruction()" mode="xml"/> | |
669 <xsl:value-of select="'</'"/> | |
670 <span class="xml elementName"><xsl:value-of select="$elementName"/></span> | |
671 <xsl:value-of select="'>'"/> | |
672 </xsl:when> | |
673 <xsl:otherwise> | |
674 <xsl:value-of select="'<'"/> | |
675 <span class="xml elementName"><xsl:value-of select="$elementName"/></span> | |
676 <xsl:apply-templates select="attribute()" mode="xml"/> | |
677 <xsl:value-of select="'/>'"/> | |
678 </xsl:otherwise> | |
679 </xsl:choose> | |
680 </xsl:variable> | |
681 <xsl:variable name="actualSN"> | |
682 <xsl:choose> | |
683 <xsl:when test=". = $firstSentence and ($topPB >> .)">0</xsl:when> | |
684 <xsl:otherwise><xsl:value-of select="count(preceding::s[. >> $topPB]) + 1"/></xsl:otherwise> | |
685 </xsl:choose> | |
686 </xsl:variable> | |
687 <xsl:choose> | |
688 <!-- Show the sentence in color light grey if it is given as sn --> | |
689 <xsl:when test="$elementName = 's' and $sn >= 0 and $sn = $actualSN"> | |
690 <ul class="xml element highlight"> | |
691 <a name="sn{$actualSN}"></a><xsl:sequence select="$elementPresentation"/> | |
692 </ul> | |
693 </xsl:when> | |
694 <xsl:when test="$elementName = 's' and $sn != $actualSN"> | |
695 <ul class="xml element"> | |
696 <a name="sn{$actualSN}"></a><xsl:sequence select="$elementPresentation"/> | |
697 </ul> | |
698 </xsl:when> | |
699 <xsl:otherwise> | |
700 <ul class="xml element"> | |
701 <xsl:sequence select="$elementPresentation"/> | |
702 </ul> | |
703 </xsl:otherwise> | |
704 </xsl:choose> | |
705 </xsl:template> | |
706 | |
707 <xsl:template match="attribute()" mode="xml"> | |
708 <xsl:variable name="attributeName" select="name()"/> | |
709 <span class="xml attributeName"> | |
710 <xsl:value-of select="' '"/> | |
711 <xsl:value-of select="$attributeName"/> | |
712 </span> | |
713 <xsl:value-of select="'="'"/> | |
714 <span class="xml attributeValue"><xsl:value-of select="."/></span><xsl:value-of select="'"'"/> | |
715 <xsl:apply-templates select="attribute()" mode="xml"/> | |
716 </xsl:template> | |
717 | |
718 <!-- If ft-query is set then highlight all term occurrences in each little text piece for the fulltext query --> | |
719 <xsl:template match="text()" mode="xml"> | |
720 <xsl:variable name="parentS" select="./ancestor::s"/> | |
721 <xsl:variable name="actualSN"> | |
722 <xsl:choose> | |
723 <xsl:when test="$parentS = $firstSentence and ($topPB >> $parentS)">0</xsl:when> | |
724 <xsl:otherwise><xsl:value-of select="count(preceding::s[. >> $topPB]) + 1"/></xsl:otherwise> | |
725 </xsl:choose> | |
726 </xsl:variable> | |
727 <xsl:choose> | |
728 <xsl:when test="$ftQueryMode != 'false' and $sn >= 0 and $sn = $actualSN"> | |
729 <xsl:sequence select="text:highlight(string(.), $ftQueryTerms, $ftQueryHighlightWords, 'false')"/> | |
730 </xsl:when> | |
731 <xsl:otherwise><xsl:value-of select="."/></xsl:otherwise> | |
732 </xsl:choose> | |
733 </xsl:template> | |
734 | |
735 | |
736 <!-- variables used by templates in mode "text" --> | |
737 <xsl:variable name="collectionName" select="/result/document-description/collection-name"/> | |
738 <xsl:variable name="documentUri" select="/result/document-description/uri"/> | |
739 <xsl:variable name="documentName" select="/result/document-description/document-name"/> | |
740 <xsl:variable name="documentIdentifier" select="/result/document-description/identifier"/> | |
741 <xsl:variable name="pageNumber" select="/result/page/number"/> | |
742 <xsl:variable name="firstFigurePosition" select="/result/page/firstFigurePosition"/> | |
743 <xsl:variable name="figuresImageDirectory" select="/result/page/figures-image-directory"/> | |
744 <xsl:variable name="figures" select="/result/page/figures"/> | |
745 <xsl:variable name="handwritten" select="/result/page/handwritten"/> | |
746 <xsl:variable name="tables" select="/result/page/tables"/> | |
747 <xsl:variable name="notes" select="/result/page/notes"/> | |
748 <xsl:variable name="charNorm" select="/result/page/character-normalization"/> | |
749 | |
750 <xsl:template match="text" mode="text"> | |
751 <xsl:apply-templates mode="text"/> | |
752 <!-- Notes --> | |
753 <xsl:if test="$collectionName = 'archimedes' and count($notes/*) > 0"> | |
754 <div> | |
755 <hr class="notesBottom"/> | |
756 <xsl:for-each select="$notes/note"> | |
757 <xsl:variable name="notePos" select="position()"/> | |
758 <xsl:variable name="label" select="$notePos"/> | |
759 <xsl:variable name="uid" select="@uid"/> | |
760 <xsl:variable name="modificationDate" select="@modificationDate"/> | |
761 <xsl:variable name="noteWithoutNamespace" select="mpdl-util:copyWithoutNamespace(.)"/> | |
762 <p> | |
763 <a> | |
764 <xsl:attribute name="name"><xsl:value-of select="concat('note-', $pageNumber, '-', $label)"/></xsl:attribute> | |
765 <xsl:attribute name="href"><xsl:value-of select="concat(urlBase, '#', 'note-', $pageNumber, '-', $label, 'ref')"/></xsl:attribute> | |
766 <xsl:value-of select="concat('[↑ note-', $pageNumber, '-', $label, ']')"/> | |
767 </a> | |
768 <xsl:value-of select="': '"/> | |
769 <xsl:choose> | |
770 <xsl:when test="$uid = '' or empty($uid)"> | |
771 <span class="note"><xsl:apply-templates select="$noteWithoutNamespace/node()" mode="text"/></span> | |
772 </xsl:when> | |
773 <xsl:otherwise> | |
774 <span class="note"><xsl:apply-templates select="$noteWithoutNamespace/node()" mode="text"/></span> | |
775 <xsl:value-of select="concat(' [external note, ', $uid, ', ', $modificationDate, ']')"/> | |
776 </xsl:otherwise> | |
777 </xsl:choose> | |
778 </p> | |
779 </xsl:for-each> | |
780 </div> | |
781 </xsl:if> | |
782 <xsl:if test="$collectionName = 'echo' and count($notes/*) > 0"> | |
783 <div> | |
784 <hr class="notesBottom"/> | |
785 <xsl:for-each select="$notes/echo:note"> | |
786 <xsl:variable name="label" select="string(@xlink:label)"/> | |
787 <xsl:variable name="uid" select="@uid"/> | |
788 <xsl:variable name="modificationDate" select="@modificationDate"/> | |
789 <xsl:variable name="noteWithoutNamespace" select="mpdl-util:copyWithoutNamespace(.)"/> | |
790 <p> | |
791 <a> | |
792 <xsl:attribute name="name"><xsl:value-of select="$label"/></xsl:attribute> | |
793 <xsl:attribute name="href"><xsl:value-of select="concat(urlBase, '#', $label, 'ref')"/></xsl:attribute> | |
794 <xsl:value-of select="concat('[↑ ', $label, ']')"/> | |
795 </a> | |
796 <xsl:value-of select="': '"/> | |
797 <xsl:choose> | |
798 <xsl:when test="$uid = '' or empty($uid)"> | |
799 <span class="note"><xsl:apply-templates select="$noteWithoutNamespace/node()" mode="text"/></span> | |
800 </xsl:when> | |
801 <xsl:otherwise> | |
802 <span class="note"><xsl:apply-templates select="$noteWithoutNamespace/node()" mode="text"/></span> | |
803 <xsl:value-of select="concat(' [external note, ', $uid, ', ', $modificationDate, ']')"/> | |
804 </xsl:otherwise> | |
805 </xsl:choose> | |
806 </p> | |
807 </xsl:for-each> | |
808 </div> | |
809 </xsl:if> | |
810 </xsl:template> | |
811 | |
812 <xsl:template match="head" mode="text"> | |
813 <p class="bf center"><xsl:apply-templates mode="text"/></p> | |
814 </xsl:template> | |
815 | |
816 <xsl:template match="div" mode="text"> | |
817 <xsl:variable name="type" select="@type"/> | |
818 <xsl:variable name="level" select="@level"/> | |
819 <xsl:variable name="style" select="@style"/> | |
820 <xsl:variable name="border" select="@border"/> | |
821 <xsl:variable name="width" select="@width"/> | |
822 <xsl:variable name="note" select="note"/> | |
823 <xsl:variable name="figure" select="figure"/> | |
824 <xsl:variable name="floatClassValue"> | |
825 <xsl:choose> | |
826 <xsl:when test="not(empty($note))"><xsl:value-of select="''"/></xsl:when> | |
827 <xsl:when test="not(empty($figure))"><xsl:value-of select="''"/></xsl:when> | |
828 <xsl:when test="$type = 'float'"><xsl:value-of select="'float left'"/></xsl:when> | |
829 <xsl:otherwise><xsl:value-of select="'float left'"/></xsl:otherwise> | |
830 </xsl:choose> | |
831 </xsl:variable> | |
832 <xsl:variable name="levelClassValue"> | |
833 <xsl:choose> | |
834 <xsl:when test="not(empty($note))"><xsl:value-of select="''"/></xsl:when> | |
835 <xsl:when test="$level = '1'"><xsl:value-of select="'level one'"/></xsl:when> | |
836 <xsl:when test="$level = '2'"><xsl:value-of select="'level two'"/></xsl:when> | |
837 <xsl:when test="$level = '3'"><xsl:value-of select="'level three'"/></xsl:when> | |
838 <xsl:when test="$level = '4'"><xsl:value-of select="'level four'"/></xsl:when> | |
839 <xsl:when test="$level = '5'"><xsl:value-of select="'level five'"/></xsl:when> | |
840 <xsl:when test="$level = '6'"><xsl:value-of select="'level six'"/></xsl:when> | |
841 <xsl:when test="$level = '7'"><xsl:value-of select="'level seven'"/></xsl:when> | |
842 <xsl:when test="$level = '8'"><xsl:value-of select="'level eight'"/></xsl:when> | |
843 <xsl:when test="$level = '9'"><xsl:value-of select="'level nine'"/></xsl:when> | |
844 <xsl:when test="empty($level)"><xsl:value-of select="''"/></xsl:when> | |
845 <xsl:otherwise><xsl:value-of select="'level n'"/></xsl:otherwise> | |
846 </xsl:choose> | |
847 </xsl:variable> | |
848 <div> | |
849 <xsl:if test="not(empty($style))"><xsl:attribute name="style"><xsl:value-of select="$style"/></xsl:attribute></xsl:if> | |
850 <xsl:attribute name="class"><xsl:value-of select="concat($floatClassValue, ' ', $levelClassValue)"/></xsl:attribute> | |
851 <xsl:apply-templates mode="text"/> | |
852 </div> | |
853 </xsl:template> | |
854 | |
855 <xsl:template match="p" mode="text"> | |
856 <xsl:variable name="style" select="@style"/> | |
857 <p> | |
858 <xsl:if test="not(empty($style))"> | |
859 <xsl:attribute name="class"><xsl:value-of select="$style"/></xsl:attribute> | |
860 </xsl:if> | |
861 <xsl:apply-templates mode="text"/> | |
862 </p> | |
863 </xsl:template> | |
864 | |
865 <xsl:template match="lb" mode="text"> | |
866 <xsl:variable name="withoutLBs"> | |
867 <xsl:choose> | |
868 <xsl:when test="contains($options, 'withoutLBs')"><xsl:value-of select="'true'"/></xsl:when> | |
869 <xsl:otherwise><xsl:value-of select="'false'"/></xsl:otherwise> | |
870 </xsl:choose> | |
871 </xsl:variable> | |
872 <xsl:if test="$withoutLBs = 'false'"><br/></xsl:if> | |
873 <xsl:apply-templates mode="text"/> | |
874 </xsl:template> | |
875 | |
876 <xsl:template match="cb" mode="text"> | |
877 <br/><xsl:apply-templates mode="text"/> | |
878 </xsl:template> | |
879 | |
880 <xsl:template match="expan" mode="text"> | |
881 <xsl:apply-templates mode="text"/><xsl:text> </xsl:text> | |
882 </xsl:template> | |
883 | |
884 <xsl:template match="note" mode="text"> | |
885 <xsl:variable name="hasLabel" select="string(@xlink:label) != ''"/> | |
886 <xsl:variable name="notePos" select="count(preceding::note[. >> $topPB]) + 1"/> | |
887 <xsl:variable name="href" select="concat('note-', $pageNumber, '-', $notePos)"/> | |
888 <xsl:choose> | |
889 <xsl:when test="$collectionName = 'archimedes'"> | |
890 <a> | |
891 <xsl:attribute name="name"><xsl:value-of select="concat($href, 'ref')"/></xsl:attribute> | |
892 <xsl:attribute name="href"><xsl:value-of select="concat(urlBase, '#', $href)"/></xsl:attribute> | |
893 <xsl:attribute name="class"><xsl:value-of select="'super'"/></xsl:attribute> | |
894 <xsl:value-of select="concat(' ↓ (', $href, ') ')"/> | |
895 </a> | |
896 </xsl:when> | |
897 <xsl:when test="$collectionName = 'echo' and not($hasLabel)"> | |
898 <p> | |
899 <xsl:value-of select="'[Note]: '"/> | |
900 <span class="note"><xsl:apply-templates mode="text"/></span> | |
901 </p> | |
902 </xsl:when> | |
903 <xsl:otherwise></xsl:otherwise> | |
904 </xsl:choose> | |
905 </xsl:template> | |
906 | |
907 <xsl:template match="emph" mode="text"> | |
908 <xsl:variable name="class" select="@class"/> | |
909 <xsl:variable name="style" select="@style"/> | |
910 <xsl:variable name="text" select="string-join(., '')"/> | |
911 <xsl:variable name="length" select="string-length($text)"/> | |
912 <xsl:variable name="firstChar" select="substring($text, 1, 1)"/> | |
913 <xsl:variable name="first2Chars" select="substring($text, 1, 2)"/> | |
914 <xsl:variable name="restChars" select="substring($text, 2, $length)"/> | |
915 <xsl:variable name="first2CharsAreUppercase" select="upper-case($first2Chars) = $first2Chars"/> | |
916 <xsl:variable name="rest"> | |
917 <xsl:choose> | |
918 <xsl:when test="$length < 2 or empty($length)"><xsl:value-of select="''"/></xsl:when> | |
919 <xsl:otherwise> | |
920 <xsl:choose> | |
921 <xsl:when test="not(empty(w))"> | |
922 <a class="textPollux" href="interface/lt/wordInfo.xql?language={w/@lang}&word={w/@form}&output=html"><xsl:value-of select="$restChars"/></a> | |
923 </xsl:when> | |
924 <xsl:otherwise><xsl:value-of select="$restChars"/></xsl:otherwise> | |
925 </xsl:choose> | |
926 </xsl:otherwise> | |
927 </xsl:choose> | |
928 </xsl:variable> | |
929 <xsl:if test="$collectionName = 'echo' and not(contains($class, 'sc'))"><span class="{$class} {$style}"><xsl:apply-templates mode="text"/></span></xsl:if> | |
930 <xsl:if test="$collectionName = 'echo' and contains($class, 'sc') and $first2CharsAreUppercase"><span class="dc {$style}"><xsl:value-of select="$firstChar"/></span><span class="{$class} {$style}"><xsl:sequence select="$rest"/></span></xsl:if> | |
931 <xsl:if test="$collectionName = 'echo' and contains($class, 'sc') and not($first2CharsAreUppercase)"><span class="{$class} {$style}"><xsl:apply-templates mode="text"/></span></xsl:if> | |
932 <xsl:if test="$collectionName = 'archimedes'"><xsl:apply-templates mode="text"/></xsl:if> | |
933 </xsl:template> | |
934 | |
935 <xsl:template match="ref" mode="text"> | |
936 <span class="ref"><xsl:apply-templates mode="text"/></span> | |
937 </xsl:template> | |
938 | |
939 <xsl:template match="foreign" mode="text"> | |
940 <xsl:variable name="lang" select="@lang"/> | |
941 <xsl:variable name="xmllang" select="@xml:lang"/> | |
942 <xsl:variable name="language"> | |
943 <xsl:choose> | |
944 <xsl:when test="not(empty($xmllang))"><xsl:value-of select="$xmllang"/></xsl:when> | |
945 <xsl:when test="not(empty($lang))"><xsl:value-of select="$lang"/></xsl:when> | |
946 <xsl:otherwise><xsl:value-of select="''"/></xsl:otherwise> | |
947 </xsl:choose> | |
948 </xsl:variable> | |
949 <span> | |
950 <xsl:attribute name="class"><xsl:value-of select="concat('foreign ', $language)"/></xsl:attribute> | |
951 <xsl:apply-templates mode="text"/> | |
952 </span> | |
953 </xsl:template> | |
954 | |
955 <xsl:template match="q" mode="text"> | |
956 <div class="q"><xsl:apply-templates mode="text"/></div> | |
957 </xsl:template> | |
958 | |
959 <xsl:template match="quote" mode="text"> | |
960 <div class="quote"><xsl:apply-templates mode="text"/></div> | |
961 </xsl:template> | |
962 | |
963 <xsl:template match="blockquote" mode="text"> | |
964 <div class="blockquote"><xsl:apply-templates mode="text"/></div> | |
965 </xsl:template> | |
966 | |
967 <xsl:template match="set-off" mode="text"> | |
968 <div class="set-off"><xsl:apply-templates mode="text"/></div> | |
969 </xsl:template> | |
970 | |
971 <xsl:template match="reg" mode="text"> | |
972 <span class="reg"> | |
973 <xsl:apply-templates mode="text"/> | |
974 </span> | |
975 </xsl:template> | |
976 | |
977 <xsl:template match="var" mode="text"> | |
978 <xsl:variable name="type" select="@type"/> | |
979 <span class="var"> | |
980 <xsl:attribute name="class"><xsl:value-of select="concat('var ', $type)"/></xsl:attribute> | |
981 <xsl:apply-templates mode="text"/> | |
982 </span> | |
983 </xsl:template> | |
984 | |
985 <xsl:template match="num" mode="text"> | |
986 <span class="num"><xsl:apply-templates mode="text"/></span> | |
987 </xsl:template> | |
988 | |
989 <xsl:template match="gap" mode="text"> | |
990 <xsl:variable name="extent" select="@extent"/> | |
991 <xsl:variable name="count"> | |
992 <xsl:choose> | |
993 <xsl:when test="empty($extent)"><xsl:value-of select="number(3)"/></xsl:when> | |
994 <xsl:otherwise><xsl:value-of select="number($extent)"/></xsl:otherwise> | |
995 </xsl:choose> | |
996 </xsl:variable> | |
997 <xsl:variable name="gapChars" select="text:nchars($count, '.')"/> | |
998 <xsl:value-of select="concat('[', $gapChars, ']')"/><xsl:apply-templates mode="text"/> | |
999 </xsl:template> | |
1000 | |
1001 <xsl:template match="anchor" mode="text"> | |
1002 <xsl:variable name="type" select="@type"/> | |
1003 <xsl:variable name="href" select="@xlink:href"/> | |
1004 <xsl:choose> | |
1005 <xsl:when test="$type = 'figure'"> | |
1006 <xsl:variable name="figure" select="$figures/echo:figure[@xlink:label = $href]"/> | |
1007 <xsl:variable name="figureFileName"> | |
1008 <xsl:choose> | |
1009 <xsl:when test="$collectionName = 'archimedes'"><xsl:value-of select="replace($figure/@xlink:href, '/', '.')"/></xsl:when> | |
1010 <xsl:when test="$collectionName = 'echo'"><xsl:value-of select="$figure/echo:image/@file"/></xsl:when> | |
1011 <xsl:otherwise><xsl:value-of select="$figure/echo:image/@file"/></xsl:otherwise> | |
1012 </xsl:choose> | |
1013 </xsl:variable> | |
1014 <xsl:variable name="figureNumber"> | |
1015 <xsl:choose> | |
1016 <xsl:when test="$collectionName = 'archimedes'"><xsl:value-of select="$firstFigurePosition + count($figure/preceding::figure)"/></xsl:when> | |
1017 <xsl:when test="$collectionName = 'echo'"><xsl:value-of select="$firstFigurePosition + count(./preceding::figure[empty(@xlink:label)]) + count(./preceding::anchor[@type = 'figure'])"/></xsl:when> | |
1018 <xsl:otherwise><xsl:value-of select="$firstFigurePosition + count(./preceding::echo:figure[empty(@xlink:label)]) + count(./preceding::echo:anchor[@type = 'figure'])"/></xsl:otherwise> | |
1019 </xsl:choose> | |
1020 </xsl:variable> | |
1021 <xsl:variable name="figureCaption" select="string-join($figure/echo:caption/text(), ' ')"/> | |
1022 <xsl:variable name="figureDescription" select="string-join($figure/echo:description/text(), ' ')"/> | |
1023 <xsl:variable name="figureVariables" select="string-join($figure/echo:variables/text(), ' ')"/> | |
1024 <xsl:sequence select="mpdl:showFigure($digilibAvailable, $figureFileName, $figureNumber, $figureCaption, $figureDescription, $figureVariables, 'float right')"/> | |
1025 </xsl:when> | |
1026 <xsl:when test="$type = 'handwritten'"> | |
1027 <xsl:variable name="hw" select="$handwritten/echo:handwritten[@xlink:label = $href]"/> | |
1028 <xsl:variable name="hwFileName" select="$hw/@file"/> | |
1029 <xsl:variable name="hwHref" select="$hw/@xlink:href"/> | |
1030 <xsl:sequence select="mpdl:showHandwritten($hwFileName, $hwHref)"/> | |
1031 </xsl:when> | |
1032 <xsl:when test="$type = 'table'"> | |
1033 <xsl:variable name="table" select="$tables/xhtml:table[@xlink:label = $href]"/> | |
1034 <xsl:sequence select="mpdl-util:copyWithoutNamespace($table)"/> | |
1035 </xsl:when> | |
1036 <xsl:when test="$type = 'note'"> | |
1037 <a> | |
1038 <xsl:attribute name="name"><xsl:value-of select="concat($href, 'ref')"/></xsl:attribute> | |
1039 <xsl:attribute name="href"><xsl:value-of select="concat(urlBase, '#', $href)"/></xsl:attribute> | |
1040 <xsl:attribute name="class"><xsl:value-of select="'super'"/></xsl:attribute> | |
1041 <xsl:value-of select="concat('↓ (', $href, ')')"/> | |
1042 </a> | |
1043 </xsl:when> | |
1044 <xsl:otherwise><a><xsl:attribute name="href"><xsl:value-of select="$href"/></xsl:attribute>Anchor of type: <xsl:value-of select="$type"/>, href: <xsl:value-of select="$href"/></a></xsl:otherwise> | |
1045 </xsl:choose> | |
1046 </xsl:template> | |
1047 | |
1048 <!-- GIS Elements --> | |
1049 <xsl:template match="place" mode="text"> | |
1050 <xsl:variable name="actualSN"> | |
1051 <xsl:choose> | |
1052 <xsl:when test=". = $firstSentence and ($topPB >> .)">0</xsl:when> | |
1053 <xsl:otherwise><xsl:value-of select="count(preceding::s[. >> $topPB]) + 1"/></xsl:otherwise> | |
1054 </xsl:choose> | |
1055 </xsl:variable> | |
1056 <xsl:variable name="id" select="@id"/> | |
1057 <xsl:variable name="echoDocDir" select="replace($figuresImageDirectory, '(.*)/.*$', '$1')"/> | |
1058 <xsl:variable name="echoDocDirTokenized" select="tokenize($echoDocDir, '/')"/> | |
1059 <xsl:variable name="echoDocDirNameSize" select="count($echoDocDirTokenized)"/> | |
1060 <xsl:variable name="echoDoc" select="string(subsequence($echoDocDirTokenized, $echoDocDirNameSize))"/> | |
1061 <xsl:variable name="docStrOld" select="concat('http://echo.mpiwg-berlin.mpg.de/ECHOdocuView?url=', $echoDocDir, '&pn=', $pageNumber, '&sn=', $actualSN, '&viewMode=gis')"/> | |
1062 <xsl:variable name="docStr" select="concat('http://mpdl-proto.mpiwg-berlin.mpg.de/mpdl/page-query-result.xql?document=', $documentUri, '&mode=gis', '&pn=', $pageNumber, '&sn=', $actualSN)"/> | |
1063 <xsl:variable name="docBase64Coded" select="saxon:string-to-base64Binary($docStr, 'utf8')"/> | |
1064 <xsl:variable name="href" select="concat('http://chinagis.mpiwg-berlin.mpg.de/chinagis/REST/db/mpdl/', $echoDoc, '?id=', $id, '&doc=', $docBase64Coded, '&format=gis')"/> | |
1065 <xsl:choose> | |
1066 <xsl:when test="$mode = 'textPollux'"> | |
1067 <xsl:variable name="wordLanguage" select="string-join(w[1]/@lang, '')"/> | |
1068 <xsl:variable name="form" select="string-join(w/@form, '')"/> | |
1069 <xsl:variable name="wordStr" select="string-join(w, '')"/> | |
1070 <xsl:variable name="lexHref"> | |
1071 <xsl:if test="not(empty(w))"> | |
1072 <xsl:value-of select="concat('interface/lt/wordInfo.xql?language=', $wordLanguage, '&word=', $form, '&output=html', '&placeHref=', encode-for-uri($href))"/> | |
1073 </xsl:if> | |
1074 <xsl:if test="empty(w)"> | |
1075 <xsl:value-of select="concat('interface/lt/wordInfo.xql?type=place', '&output=html', '&placeHref=', encode-for-uri($href))"/> | |
1076 </xsl:if> | |
1077 </xsl:variable> | |
1078 <span class="place"> | |
1079 <a class="textPollux"><xsl:attribute name="href"><xsl:value-of select="$lexHref"/></xsl:attribute><xsl:value-of select="$wordStr"/></a> | |
1080 </span> | |
1081 </xsl:when> | |
1082 <xsl:otherwise> | |
1083 <span class="place"> | |
1084 <xsl:apply-templates mode="text"/> | |
1085 </span> | |
1086 </xsl:otherwise> | |
1087 </xsl:choose> | |
1088 </xsl:template> | |
1089 | |
1090 <xsl:template match="time" mode="text"> | |
1091 <span class="time"> | |
1092 <xsl:apply-templates mode="text"/> | |
1093 </span> | |
1094 </xsl:template> | |
1095 | |
1096 <xsl:template match="person" mode="text"> | |
1097 <span class="person"> | |
1098 <xsl:apply-templates mode="text"/> | |
1099 </span> | |
1100 </xsl:template> | |
1101 | |
1102 <xsl:template match="event" mode="text"> | |
1103 <span class="event"> | |
1104 <xsl:apply-templates mode="text"/> | |
1105 </span> | |
1106 </xsl:template> | |
1107 | |
1108 <!-- MML --> | |
1109 <xsl:template match="mml:*" mode="text"> | |
1110 <xsl:copy-of select="."/> | |
1111 </xsl:template> | |
1112 | |
1113 <!-- XHTML: remove the xhtml namespace --> | |
1114 <xsl:template match="xhtml:*" mode="text"> | |
1115 <xsl:variable name="hasLabel" select="string(@xlink:label) != ''"/> | |
1116 <xsl:variable name="isTable" select="name() = 'table'"/> | |
1117 <xsl:choose> | |
1118 <xsl:when test="(not($hasLabel)) or ($isTable and $hasLabel)"> | |
1119 <xsl:element name="{name()}" namespace=""> | |
1120 <xsl:copy-of select="@*"/> | |
1121 <xsl:apply-templates mode="text"/> | |
1122 </xsl:element> | |
1123 </xsl:when> | |
1124 <xsl:otherwise></xsl:otherwise> | |
1125 </xsl:choose> | |
1126 </xsl:template> | |
1127 | |
1128 <xsl:template match="figure" mode="text"> | |
1129 <xsl:variable name="hasLabel" select="string(@xlink:label) != ''"/> | |
1130 <xsl:choose> | |
1131 <xsl:when test="not($hasLabel)"> | |
1132 <xsl:variable name="figureFileName"> | |
1133 <xsl:choose> | |
1134 <xsl:when test="$collectionName = 'archimedes'"><xsl:value-of select="replace(./@xlink:href, '/', '.')"/></xsl:when> | |
1135 <xsl:when test="$collectionName = 'echo'"><xsl:value-of select="./image/@file"/></xsl:when> | |
1136 <xsl:otherwise><xsl:value-of select="./image/@file"/></xsl:otherwise> | |
1137 </xsl:choose> | |
1138 </xsl:variable> | |
1139 <xsl:variable name="figureNumber"> | |
1140 <xsl:choose> | |
1141 <xsl:when test="$collectionName = 'archimedes'"><xsl:value-of select="$firstFigurePosition + count(./preceding::figure)"/></xsl:when> | |
1142 <xsl:when test="$collectionName = 'echo'"><xsl:value-of select="$firstFigurePosition + count(./preceding::figure[empty(@xlink:label)]) + count(./preceding::anchor[@type = 'figure'])"/></xsl:when> | |
1143 <xsl:otherwise><xsl:value-of select="$firstFigurePosition + count(./preceding::figure[empty(@xlink:label)]) + count(./preceding::anchor[@type = 'figure'])"/></xsl:otherwise> | |
1144 </xsl:choose> | |
1145 </xsl:variable> | |
1146 <xsl:variable name="figureCaption" select="./caption/text()"/> | |
1147 <xsl:variable name="figureDescription" select="./description/text()"/> | |
1148 <xsl:variable name="figureVariables" select="./variables/text()"/> | |
1149 <xsl:sequence select="mpdl:showFigure($digilibAvailable, $figureFileName, $figureNumber, $figureCaption, $figureDescription, $figureVariables, 'float none')"/> | |
1150 </xsl:when> | |
1151 <xsl:otherwise></xsl:otherwise> | |
1152 </xsl:choose> | |
1153 </xsl:template> | |
1154 | |
1155 <xsl:template match="handwritten" mode="text"> | |
1156 <xsl:variable name="hasLabel" select="string(@xlink:label) != ''"/> | |
1157 <xsl:choose> | |
1158 <xsl:when test="not($hasLabel)"> | |
1159 <xsl:variable name="fileName" select="@file"/> | |
1160 <xsl:variable name="href" select="@xlink:href"/> | |
1161 <xsl:sequence select="mpdl:showHandwritten($fileName, $href)"/> | |
1162 </xsl:when> | |
1163 <xsl:otherwise></xsl:otherwise> | |
1164 </xsl:choose> | |
1165 </xsl:template> | |
1166 | |
1167 | |
1168 | |
1169 <!-- textPollux links --> | |
1170 <xsl:template match="w" mode="text"> | |
1171 <xsl:variable name="wordLanguage" select="@lang"/> | |
1172 <xsl:variable name="form" select="@form"/> | |
1173 <a class="textPollux"> | |
1174 <xsl:attribute name="href"><xsl:value-of select="concat('interface/lt/wordInfo.xql?language=', $wordLanguage, '&word=', $form, '&output=html')"/></xsl:attribute> | |
1175 <xsl:apply-templates mode="text"/> | |
1176 </a> | |
1177 </xsl:template> | |
1178 | |
1179 <xsl:template match="s" mode="text"> | |
1180 <xsl:variable name="actualSN"> | |
1181 <xsl:choose> | |
1182 <xsl:when test=". = $firstSentence and ($topPB >> .)">0</xsl:when> | |
1183 <xsl:otherwise><xsl:value-of select="count(preceding::s[. >> $topPB]) + 1"/></xsl:otherwise> | |
1184 </xsl:choose> | |
1185 </xsl:variable> | |
1186 <a name="sn{$actualSN}"></a> | |
1187 <xsl:choose> | |
1188 <!-- Show the sentence in color light grey if it is given as sn --> | |
1189 <xsl:when test="$sn >= 0 and $sn = $actualSN"> | |
1190 <span class="s highlight"> | |
1191 <xsl:if test="contains($options, 'withXmlNodeId')"><xsl:attribute name="xmlNodeId"><xsl:value-of select="@xmlNodeId"/></xsl:attribute></xsl:if> | |
1192 <xsl:apply-templates mode="text"/> | |
1193 </span> | |
1194 </xsl:when> | |
1195 <xsl:otherwise> | |
1196 <span class="s"> | |
1197 <xsl:if test="contains($options, 'withXmlNodeId')"><xsl:attribute name="xmlNodeId"><xsl:value-of select="@xmlNodeId"/></xsl:attribute></xsl:if> | |
1198 <xsl:apply-templates mode="text"/> | |
1199 </span> | |
1200 </xsl:otherwise> | |
1201 </xsl:choose> | |
1202 </xsl:template> | |
1203 | |
1204 <!-- If ft-query is set then highlight all term occurrences in each little text piece for the fulltext query --> | |
1205 <xsl:template match="text()" mode="text"> | |
1206 <xsl:variable name="parentS" select="./ancestor::s"/> | |
1207 <xsl:variable name="actualSN"> | |
1208 <xsl:choose> | |
1209 <xsl:when test="$parentS = $firstSentence and ($topPB >> $parentS)">0</xsl:when> | |
1210 <xsl:otherwise><xsl:value-of select="count(preceding::s[. >> $topPB]) + 1"/></xsl:otherwise> | |
1211 </xsl:choose> | |
1212 </xsl:variable> | |
1213 <xsl:choose> | |
1214 <xsl:when test="$ftQueryMode != 'false' and $sn >= 0 and $sn = $actualSN"> | |
1215 <xsl:sequence select="text:highlight(string(.), $ftQueryTerms, $ftQueryHighlightWords, 'false')"/> | |
1216 </xsl:when> | |
1217 <xsl:otherwise> | |
1218 <xsl:value-of select="."/> | |
1219 </xsl:otherwise> | |
1220 </xsl:choose> | |
1221 </xsl:template> | |
1222 | |
1223 </xsl:stylesheet> |