source: main/trunk/greenstone3/web/interfaces/oran/transform/classifiertools.xsl@ 25462

Last change on this file since 25462 was 25005, checked in by sjm84, 12 years ago

Reformated the classifiertools file as well as added in the map features

File size: 5.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 <xsl:apply-templates select="." mode="default">
17 <xsl:with-param name="collName" select="$collName"/>
18 <xsl:with-param name="serviceName" select="$serviceName"/>
19 </xsl:apply-templates>
20 </div>
21 </xsl:template>
22
23
24 <xsl:template match="classifier" mode="default"> <!-- the default -->
25 <xsl:param name="collName"/>
26 <xsl:param name="serviceName"/>
27 <table id="classifiernodelist">
28 <xsl:call-template name="processNodeChildren">
29 <xsl:with-param name='collName' select='$collName'/>
30 <xsl:with-param name='serviceName' select='$serviceName'/>
31 </xsl:call-template>
32 </table>
33 </xsl:template>
34
35
36 <!-- 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 -->
37 <xsl:template name="documentNodeWrapper">
38 <xsl:param name="collName"/>
39 <xsl:param name="serviceName"/>
40 <xsl:apply-templates select=".">
41 <xsl:with-param name="collName" select="$collName"/>
42 <xsl:with-param name="serviceName" select="$serviceName"/>
43 </xsl:apply-templates>
44 <xsl:call-template name="documentNodePost"/>
45 </xsl:template>
46
47
48 <xsl:template match="documentNode">
49 <xsl:param name="collName"/>
50 <xsl:param name="serviceName"/>
51 <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']"/>
52
53 <!-- The berry (optional) -->
54 <td>
55 <xsl:call-template name="documentBerryForClassifierOrSearchPage"/>
56 </td>
57 </xsl:template>
58
59
60 <!-- icon + title template-->
61 <xsl:template match="classifierNode">
62 <xsl:param name="collName"/>
63 <xsl:param name="serviceName"/>
64 <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']"/>
65 </xsl:template>
66
67
68 <!-- processing for the recursive bit -->
69 <xsl:template match="classifierNode" mode="process-all-children">
70 <xsl:param name="collName"/>
71 <xsl:param name="serviceName"/>
72 <xsl:call-template name="processNodeChildren">
73 <xsl:with-param name='collName' select='$collName'/>
74 <xsl:with-param name='serviceName' select='$serviceName'/>
75 </xsl:call-template>
76 </xsl:template>
77
78
79 <xsl:template name="processNodeChildren">
80 <xsl:param name="collName"/>
81 <xsl:param name="serviceName"/>
82 <xsl:for-each select='classifierNode|documentNode'>
83 <tr>
84 <xsl:choose>
85 <xsl:when test="name()='documentNode'">
86 <td>
87 <table id="div{@nodeID}"><tr>
88 <xsl:call-template name="documentNodeWrapper">
89 <xsl:with-param name='collName' select='$collName'/>
90 <xsl:with-param name='serviceName' select='$serviceName'/>
91 </xsl:call-template>
92 </tr></table>
93 </td>
94 </xsl:when>
95 <xsl:otherwise>
96 <td>
97 <table id="title{@nodeID}"><tr>
98 <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'">
99 <td class="headerTD">
100 <img id="toggle{@nodeID}" onclick="toggleSection('{@nodeID}');" class="icon">
101 <xsl:attribute name="src">
102 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'expand_image')"/>
103 </xsl:attribute>
104 </img>
105 </td>
106 </xsl:if>
107 <xsl:apply-templates select='.'>
108 <xsl:with-param name='collName' select='$collName'/>
109 <xsl:with-param name='serviceName' select='$serviceName'/>
110 </xsl:apply-templates>
111 </tr></table>
112 </td>
113 <xsl:if test="child::classifierNode or child::documentNode">
114 <!--recurse into the children-->
115 <tr><td><table class="childrenlist" id="div{@nodeID}">
116 <xsl:apply-templates select='.' mode='process-all-children'>
117 <xsl:with-param name='collName' select='$collName'/>
118 <xsl:with-param name='serviceName' select='$serviceName'/>
119 </xsl:apply-templates>
120 </table></td></tr>
121 </xsl:if>
122 </xsl:otherwise>
123 </xsl:choose>
124 </tr>
125 </xsl:for-each>
126 </xsl:template>
127
128 <xsl:template name="bookshelfimg">
129 <xsl:param name="alt"/>
130 <xsl:param name="title"/>
131 <img border="0" width="20" height="16" src="interfaces/default/images/bshelf.gif" alt="{$alt}" title="{$title}"/>
132 </xsl:template>
133
134 <xsl:template name="documentNodePost">
135 <xsl:if test="/page/pageResponse/format[@type='display' or @type='browse' or @type='search']/gsf:option[@name='mapEnabled']/@value = 'true'">
136 <xsl:call-template name="mapFeatures"/>
137 </xsl:if>
138 </xsl:template>
139
140 <xsl:template name="mapFeatures">
141 <td style="padding-left:5px; padding-right:5px;" valign="top">
142 <a href="javascript:focusDocument('{@nodeID}');"><img src="sites/localsite/collect/tipple-paradise-gardens/images/map_marker.png"/></a>
143 </td>
144 </xsl:template>
145</xsl:stylesheet>
Note: See TracBrowser for help on using the repository browser.