source: main/trunk/greenstone3/web/interfaces/default/transform/system.xsl@ 32127

Last change on this file since 32127 was 26486, checked in by kjdon, 11 years ago

looks nicer like this

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