source: main/trunk/greenstone3/web/interfaces/oran/transform/formatString.xsl@ 23405

Last change on this file since 23405 was 23405, checked in by sjb48, 13 years ago

FormatAction constructs message containing format string that is sent to the collection. The message knows the service, and if it is the browse service, then it also knows the classifer list number.

File size: 9.0 KB
Line 
1<?xml version="1.0" encoding="UTF-8"?>
2<xsl:stylesheet version="1.0"
3 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
4 xmlns:xslt="http://www.w3.org/1999/XSL/Transform"
5 xmlns:gslib="http://www.greenstone.org/XSL/Library"
6 xmlns:gsf="http://www.greenstone.org/greenstone3/schema/ConfigFormat"
7 xmlns:util="http://org.greenstone.gsdl3.util.XSLTUtil"
8 exclude-result-prefixes="util gslib gsf xslt">
9
10 <!-- extension-element-prefixes="java"> -->
11
12 <xsl:strip-space elements="*"/>
13
14 <!-- style includes global params interface_name, library_name -->
15
16 <!-- the main page layout template is here -->
17<!--
18 <xsl:template name="xml">
19 <xsl:param name="fmt" select="."/>
20
21 <xsl:apply-templates select="$fmt" mode="xml"/>
22 </xsl:template>
23
24 <xsl:template match="/">
25 <xsl:apply-templates/>
26 </xsl:template>
27
28 <xsl:template match="div">
29 <h1>a div</h1>
30 <xsl:apply-templates/>
31 </xsl:template>
32
33 <xsl:template match="*">
34 <xsl:apply-templates/>
35 </xsl:template>
36-->
37
38 <xsl:template name="xml">
39 <xsl:param name="fmt" select="."/>
40 <xsl:apply-templates select="$fmt" mode="xml"/>
41 </xsl:template>
42
43 <xsl:template match="td" mode="xml">
44 <xsl:choose>
45 <xsl:when test="@title">
46 <xsl:choose>
47 <xsl:when test="@title='td'">
48 <xsl:text disable-output-escaping="yes">&lt;td valign="</xsl:text>
49 <xsl:value-of select="@valign"/>
50 <xsl:text disable-output-escaping="yes">"&gt;</xsl:text>
51 <xsl:apply-templates mode="xml"/>
52 <xsl:text disable-output-escaping="yes">&lt;/td&gt;</xsl:text>
53 </xsl:when>
54 <xsl:otherwise>
55 <xsl:apply-templates mode="xml"/>
56 </xsl:otherwise>
57 </xsl:choose>
58 </xsl:when>
59 <xsl:otherwise>
60 <xsl:apply-templates mode="xml"/>
61 </xsl:otherwise>
62 </xsl:choose>
63 </xsl:template>
64
65 <xsl:template match="div" mode="xml">
66 <xsl:choose>
67 <xsl:when test="@title">
68 <xsl:choose>
69
70 <!-- GSF TEMPLATE -->
71 <xsl:when test="@title='gsf:template'">
72 <xsl:text disable-output-escaping="yes">&lt;gsf:template</xsl:text>
73 <xsl:apply-templates mode="input"/>
74 <xsl:text disable-output-escaping="yes">&gt;</xsl:text>
75 <xsl:apply-templates mode="xml"/>
76 <xsl:text disable-output-escaping="yes">&lt;/gsf:template&gt;</xsl:text>
77 </xsl:when>
78
79 <!-- GSF METADATA -->
80 <xsl:when test="@title='gsf:metadata'">
81 <xsl:text disable-output-escaping="yes">&lt;gsf:metadata name="</xsl:text>
82 <!-- if combo is successful then don't do text - probably need to put combo in variable and test it -->
83 <xsl:variable name="metadata_test">
84 <xsl:apply-templates mode="combo"/>
85 </xsl:variable>
86 <xsl:choose>
87 <xsl:when test="$metadata_test=''">
88 <xsl:apply-templates mode="text"/>
89 </xsl:when>
90 <xsl:otherwise>
91 <xsl:value-of select="$metadata_test"/>
92 </xsl:otherwise>
93 </xsl:choose>
94 <xsl:text disable-output-escaping="yes">"/&gt;</xsl:text>
95 </xsl:when>
96
97 <!-- GSF LINK -->
98 <xsl:when test="@title='gsf:link'">
99 <xsl:text disable-output-escaping="yes">&lt;gsf:link type="</xsl:text>
100 <xsl:apply-templates mode="combo"/>
101 <xsl:text disable-output-escaping="yes">"&gt;</xsl:text>
102 <xsl:apply-templates mode="xml"/>
103 <xsl:text disable-output-escaping="yes">&lt;/gsf:link&gt;</xsl:text>
104 </xsl:when>
105
106 <!-- GSF ICON -->
107 <xsl:when test="@title='gsf:icon'">
108 <xsl:text disable-output-escaping="yes">&lt;gsf:icon type="</xsl:text>
109 <xsl:apply-templates mode="combo"/>
110 <xsl:text disable-output-escaping="yes">"&gt;&lt;/gsf:icon&gt;</xsl:text>
111 </xsl:when>
112
113 <!-- GSF CHOOSE -->
114 <xsl:when test="@title='gsf:choose-metadata'">
115 <xsl:text disable-output-escaping="yes">&lt;gsf:choose-metadata&gt;</xsl:text>
116 <xsl:apply-templates mode="xml"/>
117 <xsl:text disable-output-escaping="yes">&lt;/gsf:choose-metadata&gt;</xsl:text>
118 </xsl:when>
119
120 <!-- GSF SWITCH -->
121 <xsl:when test="@title='gsf:switch'">
122 <xsl:text disable-output-escaping="yes">&lt;gsf:switch&gt;</xsl:text>
123 <xsl:apply-templates mode="xml"/>
124 <xsl:text disable-output-escaping="yes">&lt;/gsf:switch&gt;</xsl:text>
125 </xsl:when>
126
127 <xsl:when test="@title='gsf:when'">
128 <xsl:text disable-output-escaping="yes">&lt;gsf:when test="exists"&gt;</xsl:text>
129 <xsl:apply-templates mode="xml"/>
130 <xsl:text disable-output-escaping="yes">&lt;/gsf:when&gt;</xsl:text>
131 </xsl:when>
132
133 <xsl:when test="@title='gsf:text'">
134 <xsl:apply-templates mode="text"/>
135 </xsl:when>
136
137 <xsl:when test="@title='gsf:otherwise'">
138 <xsl:apply-templates mode="xml"/>
139 </xsl:when>
140
141 <xsl:when test="@title='gsf:default'">
142 <xsl:text disable-output-escaping="yes">&lt;gsf:default&gt;</xsl:text>
143 <xsl:apply-templates mode="xml"/>
144 <xsl:text disable-output-escaping="yes">&lt;/gsf:default&gt;</xsl:text>
145 </xsl:when>
146
147 <xsl:otherwise>
148 <xsl:apply-templates mode="xml"/>
149 </xsl:otherwise>
150
151 </xsl:choose>
152 </xsl:when>
153 <xsl:otherwise>
154 <xsl:apply-templates mode="xml"/>
155 </xsl:otherwise>
156 </xsl:choose>
157 </xsl:template>
158
159
160 <!-- Strip out any plain text -->
161 <xsl:template match="text()" mode="xml">
162 <xsl:apply-templates mode="xml"/>
163 </xsl:template>
164
165 <!-- Catch all -->
166 <xsl:template match="*" mode="xml">
167 <xsl:apply-templates mode="xml"/>
168 </xsl:template>
169
170 <!-- ********************************************************************************************* -->
171
172 <!-- KEEP TEXT mode -->
173
174 <!-- Strip out any plain text -->
175 <xsl:template match="text()" mode="text">
176 <xsl:text></xsl:text><xsl:value-of select="." disable-output-escaping="yes"/><xsl:text></xsl:text>
177 <xsl:apply-templates mode="text"/>
178 </xsl:template>
179
180 <!-- Catch all -->
181 <xsl:template match="*" mode="text">
182 <xsl:apply-templates mode="text"/>
183 </xsl:template>
184
185 <!-- ********************************************************************************************* -->
186
187 <!-- INPUT mode - responsible for finding text in input tags -->
188
189 <xsl:template match="*" mode="input">
190 <xsl:apply-templates mode="input"/>
191 </xsl:template>
192
193 <xsl:template match="text()" mode="input">
194 <xsl:apply-templates mode="input"/>
195 </xsl:template>
196
197 <xsl:template match="input" mode="input">
198 <xsl:choose>
199 <xsl:when test="@class='match'">
200 <xsl:text disable-output-escaping="yes"> match="</xsl:text><xsl:value-of select="@value"/><xsl:text disable-output-escaping="yes">"</xsl:text>
201 </xsl:when>
202 <xsl:when test="@class='mode'">
203 <xsl:text disable-output-escaping="yes"> mode="</xsl:text><xsl:value-of select="@value"/><xsl:text disable-output-escaping="yes">"</xsl:text>
204 </xsl:when>
205 </xsl:choose>
206 </xsl:template>
207
208 <!-- ********************************************************************************************* -->
209
210 <!-- RAW TEXT mode -->
211
212 <xsl:template match="*" mode="text">
213 <xsl:apply-templates mode="text"/>
214 </xsl:template>
215
216 <xsl:template match="input" mode="text">
217 <xsl:choose>
218 <xsl:when test="@class='text'">
219 <xsl:value-of select="@value"/>
220 </xsl:when>
221 </xsl:choose>
222 </xsl:template>
223
224 <!-- COMBO mode - responsible for extracting value from combo box -->
225
226 <xsl:template match="*" mode="combo">
227 <xsl:apply-templates mode="combo"/>
228 </xsl:template>
229
230 <xsl:template match="text()" mode="combo">
231 <xsl:apply-templates mode="combo"/>
232 </xsl:template>
233
234 <xsl:template match="div" mode="combo">
235 </xsl:template>
236
237 <xsl:template match="option" mode="combo">
238 <xsl:if test="@selected">
239 <xsl:value-of select="@value"/>
240 </xsl:if>
241 </xsl:template>
242
243
244 <!-- ********************************************************************************************* -->
245
246 <!-- Main page generation -->
247
248 <xsl:template match="/">
249 <!-- <html>
250 <head>
251 <title>
252 <xsl:call-template name="pageTitle"/><xsl:text> </xsl:text>
253 </title>
254 </head>
255 <body>
256 <h2> This should be the format string (unmodified and html version) </h2> -->
257 <!-- <xsl:value-of select="/page/pageResponse" disable-output-escaping="yes"/> -->
258 <xsl:call-template name="xml">
259 <xsl:with-param name="fmt" select="."/>
260 </xsl:call-template><xsl:text> </xsl:text>
261 <!-- <xsl:apply-templates select="/page/pageResponse" mode="xml"/> -->
262 <!-- </body>
263 </html> -->
264 </xsl:template>
265
266 <!--
267 <xsl:template name="pageTitle">
268 <xsl:value-of select="java:org.greenstone.gsdl3.util.XSLTUtil.getInterfaceText($interface_name, /page/@lang, 'gsdl')"/>
269 </xsl:template> -->
270
271</xsl:stylesheet>
Note: See TracBrowser for help on using the repository browser.