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

Last change on this file since 24115 was 24115, checked in by sjm84, 10 years ago

Further interface updates

File size: 7.6 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:otherwise> <!-- a document link -->
54 <xslt:variable name="bookswitch">
55 <xslt:value-of select="/page/pageRequest/paramList/param[@name='book']/@value"/>
56 </xslt:variable>
57 <xslt:choose>
58 <xslt:when test="$bookswitch = 'on' or $bookswitch = 'flashxml'">
59 <a>
60 <xslt:attribute name="href">
61 <xslt:value-of select='$library_name'/>
62 <xsl:text>?a=d&amp;ed=1&amp;book=on&amp;c=</xsl:text>
63 <xslt:value-of select='/page/pageResponse/collection/@name'/>
64 <xsl:text>&amp;d=</xsl:text>
65 <xslt:value-of select='@nodeID'/>
66 <xsl:text>&amp;dt=</xsl:text>
67 <xslt:value-of select='@docType'/>
68 <xslt:if test="@nodeType='leaf'">
69 <xsl:text>&amp;sib=1</xsl:text>
70 </xslt:if>
71 <xsl:text>&amp;p.a=</xsl:text>
72 <xslt:value-of select="/page/pageRequest/@action"/>
73 <xsl:text>&amp;p.sa=</xsl:text>
74 <xsl:value-of select="/page/pageRequest/@subaction"/>
75 <xsl:text>&amp;p.s=</xsl:text>
76 <xslt:value-of select="/page/pageResponse/service/@name"/>
77 </xslt:attribute>
78 <xsl:apply-templates/>
79 </a>
80 </xslt:when>
81 <xslt:otherwise>
82 <a>
83 <xslt:attribute name="href">
84 <xslt:value-of select='$library_name'/>
85 <xsl:text>?a=d&amp;ed=1&amp;book=off&amp;c=</xsl:text>
86 <xslt:value-of select='/page/pageResponse/collection/@name'/>
87 <xsl:text>&amp;d=</xsl:text>
88 <xslt:value-of select='@nodeID'/>
89 <xsl:text>&amp;dt=</xsl:text>
90 <xslt:value-of select='@docType'/>
91 <xslt:if test="@nodeType='leaf'">
92 <xsl:text>&amp;sib=1</xsl:text>
93 </xslt:if>
94 <xsl:text>&amp;p.a=</xsl:text>
95 <xslt:value-of select="/page/pageRequest/@action"/>
96 <xsl:text>&amp;p.sa=</xsl:text>
97 <xsl:value-of select="/page/pageRequest/@subaction"/>
98 <xsl:text>&amp;p.s=</xsl:text>
99 <xslt:value-of select="/page/pageResponse/service/@name"/>
100 </xslt:attribute>
101 <xsl:apply-templates/>
102 </a>
103 </xslt:otherwise>
104 </xslt:choose>
105 </xsl:otherwise>
106 </xsl:choose>
107 </xsl:template>
108
109 <xsl:template match="gsf:icon">
110 <xsl:choose>
111 <xsl:when test="@type='classifier'">
112 <img style="width:20px; height:16px; border:0px" src="util:getInterfaceText($interface_name, /page/@lang, 'bookshelf_image')" />
113 </xsl:when>
114 <xsl:when test="@type='document'">
115 <img style="width:20px; height:16px; border:0px" src="util:getInterfaceText($interface_name, /page/@lang, 'book_image')" />
116 </xsl:when>
117 </xsl:choose>
118 </xsl:template>
119
120 <xsl:template match="gsf:metadata[@format]">
121 <xslt:value-of disable-output-escaping="yes">
122 <xsl:attribute name="select">
123 <xsl:text>java:org.greenstone.gsdl3.util.XSLTUtil.</xsl:text>
124 <xsl:value-of select="@format"/>
125 <xsl:text>(metadataList/metadata[@name='</xsl:text>
126 <xsl:apply-templates select="." mode="get-metadata-name"/>
127 <xsl:text>'], /page/@lang )</xsl:text>
128 </xsl:attribute>
129 </xslt:value-of>
130 </xsl:template>
131
132 <xsl:template match="gsf:metadata">
133 <xslt:value-of disable-output-escaping="yes">
134 <xsl:attribute name="select">
135 <xsl:text>metadataList/metadata[@name='</xsl:text>
136 <xsl:apply-templates select="." mode="get-metadata-name"/>
137 <xsl:text>']</xsl:text>
138 </xsl:attribute>
139 </xslt:value-of>
140 </xsl:template>
141
142 <xsl:template match="gsf:metadata" mode="get-metadata-name">
143 <xsl:if test="@multiple='true'">
144 <xsl:text>all_</xsl:text>
145 </xsl:if>
146 <xsl:if test='@select'>
147 <xsl:value-of select='@select'/>
148 <xsl:text>_</xsl:text>
149 </xsl:if>
150 <xsl:if test="@separator">
151 <xsl:text>*</xsl:text>
152 <xsl:value-of select='@separator'/>
153 <xsl:text>*_</xsl:text>
154 </xsl:if>
155 <xsl:value-of select="@name"/>
156 </xsl:template>
157
158 <xsl:template match="gsf:metadata-old">
159 <xslt:value-of disable-output-escaping="yes">
160 <xsl:attribute name="select">
161 <xsl:text>metadataList/metadata[@name="</xsl:text>
162 <xsl:choose>
163 <xsl:when test="@select='parent'">
164 <xsl:text>parent_</xsl:text>
165 </xsl:when>
166 <xsl:when test="@select='root'">
167 <xsl:text>root_</xsl:text>
168 </xsl:when>
169 <xsl:when test="@select='ancestors'">
170 <xsl:text>ancestors'</xsl:text>
171 <xsl:value-of select='@separator'/>
172 <xsl:text>'_</xsl:text>
173 </xsl:when>
174 <xsl:when test="@select='siblings'">
175 <xsl:text>siblings_'</xsl:text>
176 <xsl:value-of select='@separator'/>
177 <xsl:text>'_</xsl:text>
178 </xsl:when>
179 </xsl:choose>
180 <xsl:value-of select="@name"/>
181 <xsl:text>"]</xsl:text>
182 </xsl:attribute>
183 </xslt:value-of>
184 </xsl:template>
185
186 <xsl:template match="gsf:text">
187 <xslt:apply-templates select="nodeContent"/>
188 </xsl:template>
189
190 <xsl:template match="gsf:choose-metadata">
191 <xslt:choose>
192 <xsl:for-each select="gsf:metadata">
193 <xslt:when>
194 <xsl:attribute name="test">metadataList/metadata[@name='<xsl:apply-templates select="." mode="get-metadata-name"/>']</xsl:attribute>
195 <xsl:apply-templates select="."/>
196 </xslt:when>
197 </xsl:for-each>
198 <xsl:if test="gsf:default">
199 <xslt:otherwise><xsl:apply-templates select="gsf:default"/></xslt:otherwise>
200 </xsl:if>
201 </xslt:choose>
202 </xsl:template>
203
204 <xsl:template match="gsf:switch">
205 <xsl:variable name="meta-name"><xsl:apply-templates select="gsf:metadata" mode="get-metadata-name"/></xsl:variable>
206 <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>
207 <xslt:choose>
208 <xsl:for-each select="gsf:when">
209 <xslt:when test="util:{@test}($meta, '{@test-value}')">
210 <xsl:apply-templates/>
211 </xslt:when>
212 </xsl:for-each>
213 <xsl:if test="gsf:otherwise">
214 <xslt:otherwise>
215 <xsl:apply-templates select="gsf:otherwise/node()"/>
216 </xslt:otherwise>
217 </xsl:if>
218 </xslt:choose>
219 </xsl:template>
220
221 <xsl:template match="*">
222 <xsl:copy>
223 <xsl:copy-of select="@*"/>
224 <xsl:apply-templates/>
225 </xsl:copy>
226 </xsl:template>
227
228</xsl:stylesheet>
229
230
Note: See TracBrowser for help on using the repository browser.