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 | extension-element-prefixes="java util"
|
---|
7 | exclude-result-prefixes="java util">
|
---|
8 |
|
---|
9 | <xsl:include href="style.xsl"/>
|
---|
10 | <xsl:include href="service-params.xsl"/>
|
---|
11 | <xsl:output method="html"/>
|
---|
12 |
|
---|
13 | <xsl:template name="pageHead">
|
---|
14 | <xsl:variable name="docID" select="/page/pageResponse/document/@selectedNode"/>
|
---|
15 | <head>
|
---|
16 | <title><xsl:for-each select='/page/pageResponse/document/descendant::documentNode[@nodeID=$docID]/ancestor-or-self::documentNode'><xsl:if test='position()!=1'>::</xsl:if><xsl:value-of select="metadataList/metadata[@name='Title']"/></xsl:for-each><xsl:text> </xsl:text></title>
|
---|
17 | <xsl:call-template name="css-style"/>
|
---|
18 | </head>
|
---|
19 | </xsl:template>
|
---|
20 |
|
---|
21 | <!-- this is hard coded for GATE, should somehow do it dynamically-->
|
---|
22 | <xsl:template name="css-style">
|
---|
23 | <style type="text/css">
|
---|
24 | <xsl:text disable-output-escaping="yes">
|
---|
25 | span.Location { display:inline; color : red }
|
---|
26 | span.Person { display:inline; color : green }
|
---|
27 | span.Organization { display:inline; color : yellow }
|
---|
28 | span.Date { display:inline; color : blue }
|
---|
29 | span.query_term {display: inline; background-color : yellow }
|
---|
30 | </xsl:text>
|
---|
31 | </style>
|
---|
32 | </xsl:template>
|
---|
33 |
|
---|
34 | <xsl:template match="pageResponse">
|
---|
35 | <xsl:variable name="collName"><xsl:value-of select="/page/pageRequest/paramList/param[@name='c']/@value"/></xsl:variable>
|
---|
36 | <!--<center>-->
|
---|
37 | <xsl:call-template name="standardPageBanner">
|
---|
38 | <xsl:with-param name="collName" select="$collName"/>
|
---|
39 | </xsl:call-template>
|
---|
40 | <xsl:call-template name="navigationBar">
|
---|
41 | <xsl:with-param name="collName" select="$collName"/>
|
---|
42 | </xsl:call-template>
|
---|
43 | <!-- <xsl:call-template name="dividerBar"/>-->
|
---|
44 | <!-- display the document -->
|
---|
45 | <xsl:apply-templates select="document">
|
---|
46 | <xsl:with-param name="collName" select="$collName"/>
|
---|
47 | </xsl:apply-templates>
|
---|
48 | <!-- </center>-->
|
---|
49 |
|
---|
50 | <xsl:call-template name="dividerBar"/>
|
---|
51 | </xsl:template>
|
---|
52 |
|
---|
53 | <xsl:template match="document">
|
---|
54 | <xsl:param name="collName"/>
|
---|
55 | <p/>
|
---|
56 | <xsl:call-template name="documentHeading">
|
---|
57 | <xsl:with-param name="collName" select="$collName"/>
|
---|
58 | </xsl:call-template>
|
---|
59 | <p/>
|
---|
60 | <xsl:call-template name="documentContent">
|
---|
61 | <xsl:with-param name="collName" select="$collName"/>
|
---|
62 | </xsl:call-template>
|
---|
63 | </xsl:template>
|
---|
64 |
|
---|
65 | <xsl:template name="documentHeading">
|
---|
66 | <xsl:param name="collName"/>
|
---|
67 | <table width="100%" cellpadding="0" cellspacing="0">
|
---|
68 | <tr>
|
---|
69 | <td valign="top" align="left" width="200">
|
---|
70 | <xsl:call-template name="coverImage"/>
|
---|
71 | <p/>
|
---|
72 | <xsl:call-template name="enrichServices">
|
---|
73 | <xsl:with-param name="collName" select="$collName"/>
|
---|
74 | </xsl:call-template>
|
---|
75 | </td>
|
---|
76 | <td valign="top">
|
---|
77 | <xsl:call-template name="TOC">
|
---|
78 | <xsl:with-param name="collName" select="$collName"/>
|
---|
79 | </xsl:call-template>
|
---|
80 | </td>
|
---|
81 | </tr>
|
---|
82 | </table>
|
---|
83 | </xsl:template>
|
---|
84 |
|
---|
85 | <xsl:template name="coverImage">
|
---|
86 | <img><xsl:attribute name='src'><xsl:value-of select="/page/pageResponse/collection/metadataList/metadata[@name='httpPath']"/>/index/assoc/<xsl:value-of select="metadataList/metadata[@name='archivedir']"/>/cover.jpg</xsl:attribute></img>
|
---|
87 | </xsl:template>
|
---|
88 |
|
---|
89 | <xsl:template name="TOC">
|
---|
90 | <xsl:param name="collName"/>
|
---|
91 | <xsl:choose>
|
---|
92 | <xsl:when test="@docType='hierarchy'">
|
---|
93 | <xsl:call-template name="hierarchicalContents">
|
---|
94 | <xsl:with-param name="collName" select="$collName"/>
|
---|
95 | </xsl:call-template>
|
---|
96 | </xsl:when>
|
---|
97 | <xsl:when test="@docType='paged'">
|
---|
98 | <xsl:call-template name="pagedContents">
|
---|
99 | <xsl:with-param name="collName" select="$collName"/>
|
---|
100 | </xsl:call-template>
|
---|
101 | </xsl:when>
|
---|
102 | <xsl:otherwise>
|
---|
103 | <!-- just print the title of teh one and only docNode -->
|
---|
104 | <xsl:value-of disable-output-escaping="yes" select="documentNode/metadataList/metadata[@name='Title']"/>
|
---|
105 | </xsl:otherwise>
|
---|
106 | </xsl:choose>
|
---|
107 | </xsl:template>
|
---|
108 |
|
---|
109 | <xsl:template name="hierarchicalContents">
|
---|
110 | <xsl:param name="collName"/>
|
---|
111 | <xsl:apply-templates select="documentNode[@nodeID]">
|
---|
112 | <xsl:with-param name="collName" select="$collName"/>
|
---|
113 | <xsl:with-param name="depth" select="0"/>
|
---|
114 | </xsl:apply-templates>
|
---|
115 | </xsl:template>
|
---|
116 |
|
---|
117 | <xsl:template match="documentNode">
|
---|
118 | <xsl:param name="collName"/>
|
---|
119 | <xsl:param name="depth"/>
|
---|
120 | <xsl:variable name="space" select="$depth * 25"/>
|
---|
121 |
|
---|
122 | <table>
|
---|
123 | <tr valign="top">
|
---|
124 | <td>
|
---|
125 | <xsl:if test="not($depth = '0')">
|
---|
126 | <img src="interfaces/default/images/tocspace.gif" width="{$space}"/>
|
---|
127 | </xsl:if>
|
---|
128 | </td>
|
---|
129 |
|
---|
130 | <!-- Display the appropriate image, depending on the node type -->
|
---|
131 | <td valign="top">
|
---|
132 | <a><xsl:attribute name="href"><xsl:value-of select='$library_name'/>?a=d&c=<xsl:value-of select='$collName'/>&d=<xsl:value-of select='@nodeID'/><xsl:if test="documentNode">.pr</xsl:if><xsl:if test="@nodeType='leaf'">&sib=1</xsl:if></xsl:attribute>
|
---|
133 | <xsl:apply-templates select="." mode="displayNodeIcon"/>
|
---|
134 | </a>
|
---|
135 | </td>
|
---|
136 |
|
---|
137 | <!-- Display associated title, bolded if the node has content -->
|
---|
138 | <td valign="top">
|
---|
139 | <xsl:choose>
|
---|
140 | <xsl:when test="nodeContent">
|
---|
141 | <b><xsl:value-of disable-output-escaping="yes" select="metadataList/metadata[@name='Title']"/></b>
|
---|
142 | </xsl:when>
|
---|
143 | <xsl:otherwise>
|
---|
144 | <xsl:value-of disable-output-escaping="yes" select="metadataList/metadata[@name='Title']"/>
|
---|
145 | </xsl:otherwise>
|
---|
146 | </xsl:choose>
|
---|
147 | </td>
|
---|
148 | </tr>
|
---|
149 | </table>
|
---|
150 | <!-- Apply recursively to the children of this node -->
|
---|
151 | <xsl:apply-templates select="documentNode[@nodeID]">
|
---|
152 | <xsl:with-param name="collName" select="$collName"/>
|
---|
153 | <xsl:with-param name="depth" select="$depth + 1"/>
|
---|
154 | </xsl:apply-templates>
|
---|
155 | </xsl:template>
|
---|
156 |
|
---|
157 |
|
---|
158 | <!-- default content is to process any nodeContent elements and print out their text -->
|
---|
159 | <xsl:template name="documentContent">
|
---|
160 | <xsl:apply-templates select="descendant-or-self::node()/nodeContent"/>
|
---|
161 | </xsl:template>
|
---|
162 |
|
---|
163 |
|
---|
164 | <!-- the actual text/content -->
|
---|
165 | <xsl:template match="nodeContent">
|
---|
166 | <p/>
|
---|
167 | <table width="100%" cellpadding="0" cellspacing="0">
|
---|
168 | <tr>
|
---|
169 | <td align="left">
|
---|
170 | <xsl:for-each select="node()">
|
---|
171 | <xsl:choose>
|
---|
172 | <xsl:when test="not(name())"><xsl:value-of select="." disable-output-escaping="yes"/></xsl:when>
|
---|
173 | <xsl:otherwise><xsl:apply-templates select="."/></xsl:otherwise>
|
---|
174 | </xsl:choose>
|
---|
175 | </xsl:for-each>
|
---|
176 | </td>
|
---|
177 | </tr>
|
---|
178 | </table>
|
---|
179 | </xsl:template>
|
---|
180 |
|
---|
181 | <!-- match any link nodes -->
|
---|
182 |
|
---|
183 | <xsl:template match="link">
|
---|
184 | <xsl:variable name="collName" select="/page/pageRequest/paramList/param[@name='c']/@value"/>
|
---|
185 | <xsl:variable name="actionargs">
|
---|
186 | <xsl:choose>
|
---|
187 | <xsl:when test="@type='document'">a=d</xsl:when>
|
---|
188 | <xsl:when test="@type='query'">a=q&s=<xsl:value-of select="@service"/>&rt=r</xsl:when>
|
---|
189 | <xsl:otherwise>
|
---|
190 | p
|
---|
191 | </xsl:otherwise>
|
---|
192 | </xsl:choose>
|
---|
193 | </xsl:variable>
|
---|
194 | <xsl:variable name="serviceargs">
|
---|
195 | <xsl:for-each select="param">&s1.<xsl:value-of select="@name"/>=<xsl:value-of select="@value"/></xsl:for-each>
|
---|
196 | </xsl:variable>
|
---|
197 | <a href="{$library_name}?{$actionargs}&c={$collName}{$serviceargs}"><xsl:value-of disable-output-escaping="yes" select="."/></a>
|
---|
198 | </xsl:template>
|
---|
199 |
|
---|
200 | <!-- match any annotations and make them span elements -->
|
---|
201 | <xsl:template match="annotation">
|
---|
202 | <span class="{@type}"><xsl:value-of disable-output-escaping="yes" select="."/></span>
|
---|
203 | </xsl:template>
|
---|
204 |
|
---|
205 |
|
---|
206 |
|
---|
207 | <!-- paged naviagtion : INCOMPLETE!!-->
|
---|
208 | <xsl:template name="pagedContents">
|
---|
209 | <xsl:param name="collName"/>
|
---|
210 | <xsl:variable name="pos" select="nodeStructureInfo/info[@name='siblingPosition']/@value"/>
|
---|
211 | <xsl:variable name="length" select="nodeStructureInfo/info[@name='numSiblings']/@value"/>
|
---|
212 | <xsl:variable name="children" select="nodeStructureInfo/info[@name='numChildren']/@value"/>
|
---|
213 | <table>
|
---|
214 | <xsl:choose>
|
---|
215 | <xsl:when test="$pos=-1"><!-- a doc -->
|
---|
216 | <tr valign="top">
|
---|
217 | <td align="left">
|
---|
218 | </td>
|
---|
219 | <td align="center"><center>
|
---|
220 | <b><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'document.pages', $children)"/></b>
|
---|
221 | </center></td>
|
---|
222 | <td align="right">
|
---|
223 | <a href="{$library_name}?a=d&c={$collName}&d={@selectedNode}.fc"><img src="interfaces/nzdl/images/more.gif" border="0" align="absbottom" /></a>
|
---|
224 | </td>
|
---|
225 | </tr>
|
---|
226 | </xsl:when>
|
---|
227 |
|
---|
228 | <xsl:otherwise> <!-- an internal node -->
|
---|
229 | <tr valign="top">
|
---|
230 | <td align="left">
|
---|
231 | <xsl:if test=" not ( $pos = 1 )">
|
---|
232 | <a href="{$library_name}?a=d&c={$collName}&d={@selectedNode}.ps"><img src="interfaces/nzdl/images/less.gif" border="0" align="absbottom" /></a>
|
---|
233 | </xsl:if>
|
---|
234 | </td>
|
---|
235 | <td align="center"><center>
|
---|
236 | <b><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'document.pageof', concat($pos, ';', $length))"/></b>
|
---|
237 | </center></td>
|
---|
238 | <td align="right">
|
---|
239 | <xsl:if test=" not($pos = $length)">
|
---|
240 | <a href="{$library_name}?a=d&c={$collName}&d={@selectedNode}.ns"><img src="interfaces/nzdl/images/more.gif" border="0" align="absbottom" /></a>
|
---|
241 | </xsl:if>
|
---|
242 | </td>
|
---|
243 | </tr>
|
---|
244 | </xsl:otherwise>
|
---|
245 | </xsl:choose>
|
---|
246 | <tr valign="middle">
|
---|
247 | <td align='center' valign='top' colspan='3'>
|
---|
248 | <form name="GotoForm" method="get" action="/gsdl3/{$library_name}">
|
---|
249 | <input type='hidden' name='a' value='d'/>
|
---|
250 | <input type='hidden' name='c' value='{$collName}'/>
|
---|
251 | <input type='hidden' name='d' value='{@selectedNode}'/>
|
---|
252 | <input type="text" name="gp" size="3" maxlength="4"/>
|
---|
253 | <input type="submit"><xsl:attribute name='value'><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'document.gotopage')"/></xsl:attribute></input>
|
---|
254 | </form>
|
---|
255 | </td>
|
---|
256 | </tr>
|
---|
257 | </table>
|
---|
258 | </xsl:template>
|
---|
259 |
|
---|
260 | <xsl:template name="enrichServices">
|
---|
261 | <xsl:param name="collName"/>
|
---|
262 | <xsl:variable name="docID" select="/page/pageRequest/paramList/param[@name='d']/@value"/>
|
---|
263 | <xsl:for-each select="../serviceList/service">
|
---|
264 | <table border='1' cellspacing='0'>
|
---|
265 | <tr><td>
|
---|
266 | <p /><xsl:value-of select="displayItem[@name='name']"/><p/>
|
---|
267 | <form name="EnrichForm" method="get" action="/gsdl3/{$library_name}">
|
---|
268 | <xsl:apply-templates select="paramList"/>
|
---|
269 | <input type='hidden' name='a' value='d'/>
|
---|
270 | <input type='hidden' name='d' value='{$docID}'/>
|
---|
271 | <input type='hidden' name='c' value='{$collName}'/>
|
---|
272 | <xsl:if test='/page/pageRequest/paramList/param[@name="sib"]'>
|
---|
273 | <input type='hidden' name='sib'><xsl:attribute name='value'><xsl:value-of select='/page/pageRequest/paramList/param[@name="sib"]/@value'/></xsl:attribute></input></xsl:if>
|
---|
274 | <input type='hidden' name='s' value='{@name}'/>
|
---|
275 | <input type='hidden' name='ed' value='1'/>
|
---|
276 | <input type="submit"><xsl:attribute name="value"><xsl:value-of select="displayItem[@name='submit']"/></xsl:attribute></input>
|
---|
277 | </form>
|
---|
278 | </td></tr>
|
---|
279 | </table>
|
---|
280 | </xsl:for-each>
|
---|
281 | </xsl:template>
|
---|
282 |
|
---|
283 | <xsl:template match="paramList" mode="hidden">
|
---|
284 | <xsl:for-each select="param">
|
---|
285 | <input type='hidden' name='{@name}' value='{@value}'/><xsl:text>
|
---|
286 | </xsl:text>
|
---|
287 | </xsl:for-each>
|
---|
288 | </xsl:template>
|
---|
289 |
|
---|
290 | </xsl:stylesheet>
|
---|
291 |
|
---|
292 |
|
---|
293 |
|
---|
294 |
|
---|