source: main/trunk/greenstone3/web/interfaces/oran/transform/config_format.xsl@ 24340

Last change on this file since 24340 was 24340, checked in by ak19, 9 years ago

Getting a normal hierarchical classifier view to work in oran skin: this will be the look for the the default format statements that are present in collectionconfig.xml. Remove those format statements and Sam's much better interface will be displayed. To get things to work, needed to include some template match statements from default/gs3library as these were missing for dev/oran, including lots of elements from classifiertools.xsl. Dev therefore has a new file now: its own classifiertools.xsl.

File size: 8.2 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:xslt="output.xsl"
5 xmlns:java="http://xml.apache.org/xslt/java"
6 xmlns:gsf="http://www.greenstone.org/greenstone3/schema/ConfigFormat"
7 xmlns:util="xalan://org.greenstone.gsdl3.util.XSLTUtil"
8 extension-element-prefixes="java">
9
10 <xsl:output method="xml"/>
11 <xsl:namespace-alias stylesheet-prefix="xslt" result-prefix="xsl"/>
12
13 <xsl:template match="format">
14 <format>
15 <xsl:apply-templates/>
16 </format>
17 </xsl:template>
18
19 <xsl:template match="gsf:template">
20 <xslt:template>
21 <xsl:copy-of select="@*"/>
22 <xsl:attribute name="priority">2</xsl:attribute>
23 <xsl:if test=".//gsf:link">
24 <xslt:param name="serviceName"/>
25 <xslt:param name="collName"/>
26 </xsl:if>
27 <xsl:apply-templates/>
28 </xslt:template>
29 </xsl:template>
30
31 <xsl:template match="gsf:link">
32 <xsl:choose>
33 <xsl:when test="@type='classifier'">
34 <a>
35 <xslt:attribute name='href'>
36 <xslt:value-of select='$library_name'/>
37 <xsl:text>?a=b&amp;rt=r&amp;s=</xsl:text>
38 <xslt:value-of select='/page/pageResponse/service/@name'/>
39 <xsl:text>&amp;c=</xsl:text>
40 <xslt:value-of select='/page/pageResponse/collection/@name'/>
41 <xsl:text>&amp;cl=</xsl:text>
42 <xslt:value-of select='@nodeID'/>
43 <xslt:if test="classifierNode|documentNode">
44 <xsl:text>.pr</xsl:text>
45 </xslt:if>
46 <xslt:if test="parent::node()[@orientation='horizontal']">
47 <xsl:text>&amp;sib=1</xsl:text>
48 </xslt:if>
49 </xslt:attribute>
50 <xsl:apply-templates/>
51 </a>
52 </xsl:when>
53 <xsl:when test="@type='source'">
54 <a><xslt:attribute name='href'><xslt:value-of
55 disable-output-escaping="yes" select="/page/pageResponse/collection/metadataList/metadata[@name='httpPath']" />/index/assoc/<xslt:value-of
56 disable-output-escaping="yes" select="metadataList/metadata[@name='assocfilepath']" />/<xslt:value-of
57 disable-output-escaping="yes" select="metadataList/metadata[@name='srclinkFile']" /></xslt:attribute>
58 <xsl:apply-templates/>
59 </a>
60 </xsl:when>
61
62 <xsl:otherwise> <!-- a document link -->
63 <xslt:variable name="bookswitch">
64 <xslt:value-of select="/page/pageRequest/paramList/param[@name='book']/@value"/>
65 </xslt:variable>
66 <xslt:choose>
67 <xslt:when test="$bookswitch = 'on' or $bookswitch = 'flashxml'">
68 <a>
69 <xslt:attribute name="href">
70 <xslt:value-of select='$library_name'/>
71 <xsl:text>?a=d&amp;ed=1&amp;book=on&amp;c=</xsl:text>
72 <xslt:value-of select='/page/pageResponse/collection/@name'/>
73 <xsl:text>&amp;d=</xsl:text>
74 <xslt:value-of select='@nodeID'/>
75 <xsl:text>&amp;dt=</xsl:text>
76 <xslt:value-of select='@docType'/>
77 <xslt:if test="@nodeType='leaf'">
78 <xsl:text>&amp;sib=1</xsl:text>
79 </xslt:if>
80 <xsl:text>&amp;p.a=</xsl:text>
81 <xslt:value-of select="/page/pageRequest/@action"/>
82 <xsl:text>&amp;p.sa=</xsl:text>
83 <xsl:value-of select="/page/pageRequest/@subaction"/>
84 <xsl:text>&amp;p.s=</xsl:text>
85 <xslt:value-of select="/page/pageResponse/service/@name"/>
86 </xslt:attribute>
87 <xsl:apply-templates/>
88 </a>
89 </xslt:when>
90 <xslt:otherwise>
91 <a>
92 <xslt:attribute name="href">
93 <xslt:value-of select='$library_name'/>
94 <xsl:text>?a=d&amp;ed=1&amp;book=off&amp;c=</xsl:text>
95 <xslt:value-of select='/page/pageResponse/collection/@name'/>
96 <xsl:text>&amp;d=</xsl:text>
97 <xslt:value-of select='@nodeID'/>
98 <xsl:text>&amp;dt=</xsl:text>
99 <xslt:value-of select='@docType'/>
100 <xslt:if test="@nodeType='leaf'">
101 <xsl:text>&amp;sib=1</xsl:text>
102 </xslt:if>
103 <xsl:text>&amp;p.a=</xsl:text>
104 <xslt:value-of select="/page/pageRequest/@action"/>
105 <xsl:text>&amp;p.sa=</xsl:text>
106 <xsl:value-of select="/page/pageRequest/@subaction"/>
107 <xsl:text>&amp;p.s=</xsl:text>
108 <xslt:value-of select="/page/pageResponse/service/@name"/>
109 </xslt:attribute>
110 <xsl:apply-templates/>
111 </a>
112 </xslt:otherwise>
113 </xslt:choose>
114 </xsl:otherwise>
115 </xsl:choose>
116 </xsl:template>
117
118 <xsl:template match="gsf:icon">
119 <xsl:choose>
120 <xsl:when test="@type='classifier'">
121 <img style="width:20px; height:16px; border:0px"><xsl:attribute name="src"><xsl:text>interfaces/oran/images/bookshelf.png</xsl:text></xsl:attribute></img>
122 </xsl:when>
123 <xsl:when test="@type='document'">
124 <img style="width:20px; height:16px; border:0px"><xsl:attribute name="src"><xsl:text>interfaces/oran/images/itext.gif</xsl:text></xsl:attribute></img>
125 </xsl:when>
126 </xsl:choose>
127 </xsl:template>
128
129 <xsl:template match="gsf:metadata[@format]">
130 <xslt:value-of disable-output-escaping="yes">
131 <xsl:attribute name="select">
132 <xsl:text>java:org.greenstone.gsdl3.util.XSLTUtil.</xsl:text>
133 <xsl:value-of select="@format"/>
134 <xsl:text>(metadataList/metadata[@name='</xsl:text>
135 <xsl:apply-templates select="." mode="get-metadata-name"/>
136 <xsl:text>'], /page/@lang )</xsl:text>
137 </xsl:attribute>
138 </xslt:value-of>
139 </xsl:template>
140
141 <xsl:template match="gsf:metadata">
142 <xslt:value-of disable-output-escaping="yes">
143 <xsl:attribute name="select">
144 <xsl:text>metadataList/metadata[@name='</xsl:text>
145 <xsl:apply-templates select="." mode="get-metadata-name"/>
146 <xsl:text>']</xsl:text>
147 </xsl:attribute>
148 </xslt:value-of>
149 </xsl:template>
150
151 <xsl:template match="gsf:metadata" mode="get-metadata-name">
152 <xsl:if test="@multiple='true'">
153 <xsl:text>all_</xsl:text>
154 </xsl:if>
155 <xsl:if test='@select'>
156 <xsl:value-of select='@select'/>
157 <xsl:text>_</xsl:text>
158 </xsl:if>
159 <xsl:if test="@separator">
160 <xsl:text>*</xsl:text>
161 <xsl:value-of select='@separator'/>
162 <xsl:text>*_</xsl:text>
163 </xsl:if>
164 <xsl:value-of select="@name"/>
165 </xsl:template>
166
167 <xsl:template match="gsf:metadata-old">
168 <xslt:value-of disable-output-escaping="yes">
169 <xsl:attribute name="select">
170 <xsl:text>metadataList/metadata[@name="</xsl:text>
171 <xsl:choose>
172 <xsl:when test="@select='parent'">
173 <xsl:text>parent_</xsl:text>
174 </xsl:when>
175 <xsl:when test="@select='root'">
176 <xsl:text>root_</xsl:text>
177 </xsl:when>
178 <xsl:when test="@select='ancestors'">
179 <xsl:text>ancestors'</xsl:text>
180 <xsl:value-of select='@separator'/>
181 <xsl:text>'_</xsl:text>
182 </xsl:when>
183 <xsl:when test="@select='siblings'">
184 <xsl:text>siblings_'</xsl:text>
185 <xsl:value-of select='@separator'/>
186 <xsl:text>'_</xsl:text>
187 </xsl:when>
188 </xsl:choose>
189 <xsl:value-of select="@name"/>
190 <xsl:text>"]</xsl:text>
191 </xsl:attribute>
192 </xslt:value-of>
193 </xsl:template>
194
195 <xsl:template match="gsf:text">
196 <xslt:apply-templates select="nodeContent"/>
197 </xsl:template>
198
199 <xsl:template match="gsf:choose-metadata">
200 <xslt:choose>
201 <xsl:for-each select="gsf:metadata">
202 <xslt:when>
203 <xsl:attribute name="test">metadataList/metadata[@name='<xsl:apply-templates select="." mode="get-metadata-name"/>']</xsl:attribute>
204 <xsl:apply-templates select="."/>
205 </xslt:when>
206 </xsl:for-each>
207 <xsl:if test="gsf:default">
208 <xslt:otherwise><xsl:apply-templates select="gsf:default"/></xslt:otherwise>
209 </xsl:if>
210 </xslt:choose>
211 </xsl:template>
212
213 <xsl:template match="gsf:switch">
214 <xsl:variable name="meta-name"><xsl:apply-templates select="gsf:metadata" mode="get-metadata-name"/></xsl:variable>
215 <xslt:variable name="meta"><xsl:choose><xsl:when test="@preprocess"><xslt:value-of select="util:{@preprocess}(metadataList/metadata[@name='{$meta-name}'])"/></xsl:when><xsl:otherwise><xslt:value-of select="metadataList/metadata[@name='{$meta-name}']"/></xsl:otherwise></xsl:choose></xslt:variable>
216 <xslt:choose>
217 <xsl:for-each select="gsf:when">
218 <xslt:when test="util:{@test}($meta, '{@test-value}')">
219 <xsl:apply-templates/>
220 </xslt:when>
221 </xsl:for-each>
222 <xsl:if test="gsf:otherwise">
223 <xslt:otherwise>
224 <xsl:apply-templates select="gsf:otherwise/node()"/>
225 </xslt:otherwise>
226 </xsl:if>
227 </xslt:choose>
228 </xsl:template>
229
230 <xsl:template match="*">
231 <xsl:copy>
232 <xsl:copy-of select="@*"/>
233 <xsl:apply-templates/>
234 </xsl:copy>
235 </xsl:template>
236
237</xsl:stylesheet>
238
239
Note: See TracBrowser for help on using the repository browser.