source: main/trunk/greenstone3/web/interfaces/default/transform/classifiertools.xsl@ 26148

Last change on this file since 26148 was 26148, checked in by davidb, 12 years ago

Extra 'if-statement' added to the Google maps support. Only want the marker icons added in if the given document has Latitude and Longitude metadata

File size: 6.8 KB
Line 
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:gsf="http://www.greenstone.org/greenstone3/schema/ConfigFormat"
7 extension-element-prefixes="java util"
8 exclude-result-prefixes="java util gsf">
9
10
11 <xsl:template match="classifier">
12 <xsl:param name="collName"/>
13 <xsl:param name="serviceName"/>
14 <div id="classifiers">
15 <xsl:variable name="cl_name"><xsl:value-of select="@name"/></xsl:variable>
16 <table id="classifiernodelist">
17 <xsl:call-template name="processNodeChildren">
18 <xsl:with-param name='collName' select='$collName'/>
19 <xsl:with-param name='serviceName' select='$serviceName'/>
20 </xsl:call-template>
21 </table>
22 </div>
23 </xsl:template>
24
25 <!-- this is a wrapper node, which the interface can use to add stuff into the query results that isn't part of and doesn't depend on the documentNode template which may come from the collection -->
26 <xsl:template name="documentNodeWrapper">
27 <xsl:param name="collName"/>
28 <xsl:param name="serviceName"/>
29 <xsl:apply-templates select=".">
30 <xsl:with-param name="collName" select="$collName"/>
31 <xsl:with-param name="serviceName" select="$serviceName"/>
32 </xsl:apply-templates>
33 <!-- The berry (optional) -->
34 <td>
35 <xsl:call-template name="documentBerryForClassifierOrSearchPage"/>
36 </td>
37 <xsl:call-template name="documentNodePost"/>
38 </xsl:template>
39
40
41 <xsl:template match="documentNode">
42 <xsl:param name="collName"/>
43 <xsl:param name="serviceName"/>
44 <a href="{$library_name}?a=d&amp;c={$collName}&amp;d={@nodeID}&amp;dt={@docType}&amp;p.a=b&amp;p.s={$serviceName}"><xsl:apply-templates select="." mode="displayNodeIcon"/></a><xsl:value-of disable-output-escaping="yes" select="metadataList/metadata[@name='Title']"/>
45 </xsl:template>
46
47
48 <!-- icon + title template-->
49 <xsl:template match="classifierNode">
50 <xsl:param name="collName"/>
51 <xsl:param name="serviceName"/>
52 <a><xsl:attribute name='href'><xsl:value-of select='$library_name'/>?a=b&amp;rt=r&amp;s=<xsl:value-of select='$serviceName'/>&amp;c=<xsl:value-of select='$collName'/>&amp;cl=<xsl:value-of select='@nodeID'/><xsl:if test="classifierNode|documentNode">.pr</xsl:if></xsl:attribute><xsl:call-template name="bookshelfimg"/></a><xsl:value-of disable-output-escaping="yes" select="metadataList/metadata[@name='Title']"/>
53 </xsl:template>
54
55
56 <!-- processing for the recursive bit -->
57 <xsl:template match="classifierNode" mode="process-all-children">
58 <xsl:param name="collName"/>
59 <xsl:param name="serviceName"/>
60 <xsl:call-template name="processNodeChildren">
61 <xsl:with-param name='collName' select='$collName'/>
62 <xsl:with-param name='serviceName' select='$serviceName'/>
63 </xsl:call-template>
64 </xsl:template>
65
66
67 <xsl:template name="processNodeChildren">
68 <xsl:param name="collName"/>
69 <xsl:param name="serviceName"/>
70 <xsl:choose>
71 <xsl:when test="@childType = 'VList' or @childType = 'DateList'">
72 <xsl:for-each select='classifierNode|documentNode'>
73 <tr>
74 <xsl:choose>
75 <xsl:when test="name()='documentNode'">
76 <td>
77 <table id="div{@nodeID}"><tr>
78 <xsl:call-template name="documentNodeWrapper">
79 <xsl:with-param name='collName' select='$collName'/>
80 <xsl:with-param name='serviceName' select='$serviceName'/>
81 </xsl:call-template>
82 </tr></table>
83 </td>
84 </xsl:when>
85 <xsl:when test="name()='classifierNode' and @childType = 'VList'">
86 <td>
87 <table id="title{@nodeID}"><tr>
88 <xsl:if test="not(/page/pageResponse/format[@type='browse']/gsf:option[@name='turnstyleClassifiers']) or /page/pageResponse/format[@type='browse']/gsf:option[@name='turnstyleClassifiers']/@value='true'">
89 <td class="headerTD">
90 <img id="toggle{@nodeID}" onclick="toggleSection('{@nodeID}');" class="icon">
91 <xsl:attribute name="src">
92 <xsl:choose>
93 <xsl:when test="classifierNode or documentNode">
94 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'collapse_image')"/>
95 </xsl:when>
96 <xsl:otherwise>
97 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'expand_image')"/>
98 </xsl:otherwise>
99 </xsl:choose>
100 </xsl:attribute>
101 </img>
102 </td>
103 </xsl:if>
104 <xsl:apply-templates select='.'>
105 <xsl:with-param name='collName' select='$collName'/>
106 <xsl:with-param name='serviceName' select='$serviceName'/>
107 </xsl:apply-templates>
108 </tr></table>
109 </td>
110 <xsl:if test="child::classifierNode or child::documentNode">
111 <!--recurse into the children-->
112 <tr><td><table class="childrenlist" id="div{@nodeID}">
113 <xsl:apply-templates select='.' mode='process-all-children'>
114 <xsl:with-param name='collName' select='$collName'/>
115 <xsl:with-param name='serviceName' select='$serviceName'/>
116 </xsl:apply-templates>
117 </table></td></tr>
118 </xsl:if>
119 </xsl:when>
120 <xsl:otherwise>Unknown classifier style specified</xsl:otherwise>
121 </xsl:choose>
122 </tr>
123 </xsl:for-each>
124 </xsl:when>
125 <xsl:when test="@childType = 'HList'">
126 <ul class="horizontalContainer">
127 <xsl:for-each select='classifierNode'>
128 <li class="horizontalClassifierNode">
129 <xsl:apply-templates select='.'>
130 <xsl:with-param name='collName' select='$collName'/>
131 <xsl:with-param name='serviceName' select='$serviceName'/>
132 </xsl:apply-templates>
133 </li>
134 </xsl:for-each>
135 </ul>
136 <xsl:for-each select='classifierNode'>
137 <xsl:call-template name="processNodeChildren">
138 <xsl:with-param name='collName' select='$collName'/>
139 <xsl:with-param name='serviceName' select='$serviceName'/>
140 </xsl:call-template>
141 </xsl:for-each>
142 </xsl:when>
143 </xsl:choose>
144 </xsl:template>
145
146 <xsl:template name="bookshelfimg">
147 <xsl:param name="alt"/>
148 <xsl:param name="title"/>
149 <img border="0" width="20" height="16" src="interfaces/default/images/bshelf.gif" alt="{$alt}" title="{$title}"/>
150 </xsl:template>
151
152 <xsl:template name="documentNodePost">
153 <xsl:if test="/page/pageResponse/format[@type='display' or @type='browse' or @type='search']/gsf:option[@name='mapEnabled']/@value = 'true'">
154 <xsl:if test="metadataList/metadata[@name='Latitude' or @name='Longitude']">
155 <xsl:call-template name="mapFeatures"/>
156 </xsl:if>
157 </xsl:if>
158 </xsl:template>
159
160select="
161
162 <xsl:template name="mapFeatures">
163 <td style="padding-left:5px; padding-right:5px;" valign="top">
164 <a href="javascript:focusDocument('{@nodeID}');"><img src="interfaces/{$interface_name}/images/map_marker.png"/></a>
165 </td>
166 </xsl:template>
167</xsl:stylesheet>
Note: See TracBrowser for help on using the repository browser.