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