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

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

Starting working on new format statement save architecture. This involves a new action, FormatAction, which will be responsible for the XSL transform and will pass the format string to the Collection object via the Message Router,

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