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

Last change on this file since 24510 was 24510, checked in by sjm84, 13 years ago

Some updates, mostly to do with adding in the new document maker functionality

File size: 9.0 KB
RevLine 
[19860]1<?xml version="1.0" encoding="ISO-8859-1"?>
2<xsl:stylesheet version="1.0"
[24115]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">
[24458]9 <xsl:param name="interface_name"/>
10 <xsl:param name="library_name"/>
[19860]11
[24115]12 <xsl:output method="xml"/>
13 <xsl:namespace-alias stylesheet-prefix="xslt" result-prefix="xsl"/>
[19860]14
[24115]15 <xsl:template match="format">
16 <format>
17 <xsl:apply-templates/>
18 </format>
19 </xsl:template>
[19860]20
[24115]21 <xsl:template match="gsf:template">
22 <xslt:template>
23 <xsl:copy-of select="@*"/>
24 <xsl:attribute name="priority">2</xsl:attribute>
25 <xsl:if test=".//gsf:link">
26 <xslt:param name="serviceName"/>
27 <xslt:param name="collName"/>
28 </xsl:if>
29 <xsl:apply-templates/>
30 </xslt:template>
31 </xsl:template>
[24458]32
33 <xsl:template match="gsf:variable">
34 <xslt:variable>
35 <xsl:copy-of select="@*"/>
36 <xsl:apply-templates/>
37 </xslt:variable>
38 <script type="text/javascript">
39 gs.variables.<xsl:value-of select="@name"/><xslt:text disable-output-escaping="yes"> = "</xslt:text><xsl:apply-templates/><xslt:text disable-output-escaping="yes">";</xslt:text>
40 </script>
41 </xsl:template>
[19860]42
[24115]43 <xsl:template match="gsf:link">
44 <xsl:choose>
45 <xsl:when test="@type='classifier'">
46 <a>
47 <xslt:attribute name='href'>
48 <xslt:value-of select='$library_name'/>
49 <xsl:text>?a=b&amp;rt=r&amp;s=</xsl:text>
50 <xslt:value-of select='/page/pageResponse/service/@name'/>
51 <xsl:text>&amp;c=</xsl:text>
52 <xslt:value-of select='/page/pageResponse/collection/@name'/>
53 <xsl:text>&amp;cl=</xsl:text>
54 <xslt:value-of select='@nodeID'/>
55 <xslt:if test="classifierNode|documentNode">
56 <xsl:text>.pr</xsl:text>
57 </xslt:if>
58 <xslt:if test="parent::node()[@orientation='horizontal']">
59 <xsl:text>&amp;sib=1</xsl:text>
60 </xslt:if>
61 </xslt:attribute>
62 <xsl:apply-templates/>
63 </a>
64 </xsl:when>
[24127]65 <xsl:when test="@type='source'">
66 <a><xslt:attribute name='href'><xslt:value-of
67 disable-output-escaping="yes" select="/page/pageResponse/collection/metadataList/metadata[@name='httpPath']" />/index/assoc/<xslt:value-of
68 disable-output-escaping="yes" select="metadataList/metadata[@name='assocfilepath']" />/<xslt:value-of
[24340]69 disable-output-escaping="yes" select="metadataList/metadata[@name='srclinkFile']" /></xslt:attribute>
[24127]70 <xsl:apply-templates/>
71 </a>
72 </xsl:when>
73
[24115]74 <xsl:otherwise> <!-- a document link -->
75 <xslt:variable name="bookswitch">
76 <xslt:value-of select="/page/pageRequest/paramList/param[@name='book']/@value"/>
77 </xslt:variable>
78 <xslt:choose>
79 <xslt:when test="$bookswitch = 'on' or $bookswitch = 'flashxml'">
80 <a>
81 <xslt:attribute name="href">
82 <xslt:value-of select='$library_name'/>
83 <xsl:text>?a=d&amp;ed=1&amp;book=on&amp;c=</xsl:text>
84 <xslt:value-of select='/page/pageResponse/collection/@name'/>
85 <xsl:text>&amp;d=</xsl:text>
86 <xslt:value-of select='@nodeID'/>
87 <xsl:text>&amp;dt=</xsl:text>
88 <xslt:value-of select='@docType'/>
89 <xslt:if test="@nodeType='leaf'">
90 <xsl:text>&amp;sib=1</xsl:text>
91 </xslt:if>
92 <xsl:text>&amp;p.a=</xsl:text>
93 <xslt:value-of select="/page/pageRequest/@action"/>
94 <xsl:text>&amp;p.sa=</xsl:text>
95 <xsl:value-of select="/page/pageRequest/@subaction"/>
96 <xsl:text>&amp;p.s=</xsl:text>
97 <xslt:value-of select="/page/pageResponse/service/@name"/>
98 </xslt:attribute>
99 <xsl:apply-templates/>
100 </a>
101 </xslt:when>
102 <xslt:otherwise>
103 <a>
104 <xslt:attribute name="href">
105 <xslt:value-of select='$library_name'/>
[24510]106 <xsl:text disable-output-escaping="yes">?a=d&amp;ed=1&amp;book=off&amp;c=</xsl:text>
[24115]107 <xslt:value-of select='/page/pageResponse/collection/@name'/>
[24510]108 <xsl:text disable-output-escaping="yes">&amp;d=</xsl:text>
[24115]109 <xslt:value-of select='@nodeID'/>
[24510]110 <xsl:text disable-output-escaping="yes">&amp;dt=</xsl:text>
[24115]111 <xslt:value-of select='@docType'/>
112 <xslt:if test="@nodeType='leaf'">
[24510]113 <xsl:text disable-output-escaping="yes">&amp;sib=1</xsl:text>
[24115]114 </xslt:if>
[24510]115 <xsl:text disable-output-escaping="yes">&amp;p.a=</xsl:text>
[24115]116 <xslt:value-of select="/page/pageRequest/@action"/>
[24510]117 <xsl:text disable-output-escaping="yes">&amp;p.sa=</xsl:text>
[24115]118 <xsl:value-of select="/page/pageRequest/@subaction"/>
[24510]119 <xsl:text disable-output-escaping="yes">&amp;p.s=</xsl:text>
[24115]120 <xslt:value-of select="/page/pageResponse/service/@name"/>
121 </xslt:attribute>
122 <xsl:apply-templates/>
123 </a>
124 </xslt:otherwise>
125 </xslt:choose>
126 </xsl:otherwise>
127 </xsl:choose>
128 </xsl:template>
[19860]129
[24115]130 <xsl:template match="gsf:icon">
131 <xsl:choose>
132 <xsl:when test="@type='classifier'">
[24458]133 <img style="border:0px"><xsl:attribute name="src"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'bookshelf_image')"/></xsl:attribute></img>
[24115]134 </xsl:when>
135 <xsl:when test="@type='document'">
[24510]136 <img style="border:0px"><xslt:attribute name="id">documentBasketBook<xslt:value-of select="/page/pageResponse/collection/@name"/>:<xslt:value-of select="@nodeID"/></xslt:attribute><xslt:attribute name="src"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'page_icon_image')"/></xslt:attribute></img>
[24115]137 </xsl:when>
138 </xsl:choose>
139 </xsl:template>
[24359]140
[24115]141 <xsl:template match="gsf:metadata[@format]">
142 <xslt:value-of disable-output-escaping="yes">
143 <xsl:attribute name="select">
144 <xsl:text>java:org.greenstone.gsdl3.util.XSLTUtil.</xsl:text>
145 <xsl:value-of select="@format"/>
146 <xsl:text>(metadataList/metadata[@name='</xsl:text>
147 <xsl:apply-templates select="." mode="get-metadata-name"/>
148 <xsl:text>'], /page/@lang )</xsl:text>
149 </xsl:attribute>
150 </xslt:value-of>
151 </xsl:template>
[19860]152
[24115]153 <xsl:template match="gsf:metadata">
154 <xslt:value-of disable-output-escaping="yes">
155 <xsl:attribute name="select">
156 <xsl:text>metadataList/metadata[@name='</xsl:text>
157 <xsl:apply-templates select="." mode="get-metadata-name"/>
158 <xsl:text>']</xsl:text>
159 </xsl:attribute>
160 </xslt:value-of>
161 </xsl:template>
[19860]162
[24115]163 <xsl:template match="gsf:metadata" mode="get-metadata-name">
164 <xsl:if test="@multiple='true'">
165 <xsl:text>all_</xsl:text>
166 </xsl:if>
167 <xsl:if test='@select'>
168 <xsl:value-of select='@select'/>
169 <xsl:text>_</xsl:text>
170 </xsl:if>
171 <xsl:if test="@separator">
172 <xsl:text>*</xsl:text>
173 <xsl:value-of select='@separator'/>
174 <xsl:text>*_</xsl:text>
175 </xsl:if>
176 <xsl:value-of select="@name"/>
177 </xsl:template>
[19860]178
[24115]179 <xsl:template match="gsf:metadata-old">
180 <xslt:value-of disable-output-escaping="yes">
181 <xsl:attribute name="select">
182 <xsl:text>metadataList/metadata[@name="</xsl:text>
183 <xsl:choose>
184 <xsl:when test="@select='parent'">
185 <xsl:text>parent_</xsl:text>
186 </xsl:when>
187 <xsl:when test="@select='root'">
188 <xsl:text>root_</xsl:text>
189 </xsl:when>
190 <xsl:when test="@select='ancestors'">
191 <xsl:text>ancestors'</xsl:text>
192 <xsl:value-of select='@separator'/>
193 <xsl:text>'_</xsl:text>
194 </xsl:when>
195 <xsl:when test="@select='siblings'">
196 <xsl:text>siblings_'</xsl:text>
197 <xsl:value-of select='@separator'/>
198 <xsl:text>'_</xsl:text>
199 </xsl:when>
200 </xsl:choose>
201 <xsl:value-of select="@name"/>
202 <xsl:text>"]</xsl:text>
203 </xsl:attribute>
204 </xslt:value-of>
205 </xsl:template>
[19860]206
[24115]207 <xsl:template match="gsf:text">
208 <xslt:apply-templates select="nodeContent"/>
209 </xsl:template>
[19860]210
[24115]211 <xsl:template match="gsf:choose-metadata">
212 <xslt:choose>
213 <xsl:for-each select="gsf:metadata">
214 <xslt:when>
215 <xsl:attribute name="test">metadataList/metadata[@name='<xsl:apply-templates select="." mode="get-metadata-name"/>']</xsl:attribute>
216 <xsl:apply-templates select="."/>
217 </xslt:when>
218 </xsl:for-each>
219 <xsl:if test="gsf:default">
220 <xslt:otherwise><xsl:apply-templates select="gsf:default"/></xslt:otherwise>
221 </xsl:if>
222 </xslt:choose>
223 </xsl:template>
[19860]224
[24115]225 <xsl:template match="gsf:switch">
226 <xsl:variable name="meta-name"><xsl:apply-templates select="gsf:metadata" mode="get-metadata-name"/></xsl:variable>
227 <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>
228 <xslt:choose>
229 <xsl:for-each select="gsf:when">
230 <xslt:when test="util:{@test}($meta, '{@test-value}')">
231 <xsl:apply-templates/>
232 </xslt:when>
233 </xsl:for-each>
234 <xsl:if test="gsf:otherwise">
235 <xslt:otherwise>
236 <xsl:apply-templates select="gsf:otherwise/node()"/>
237 </xslt:otherwise>
238 </xsl:if>
239 </xslt:choose>
240 </xsl:template>
[19860]241
[24115]242 <xsl:template match="*">
243 <xsl:copy>
244 <xsl:copy-of select="@*"/>
245 <xsl:apply-templates/>
246 </xsl:copy>
247 </xsl:template>
[19860]248
249</xsl:stylesheet>
250
251
Note: See TracBrowser for help on using the repository browser.