[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>
|
---|
[24792] | 42 |
|
---|
| 43 | <xsl:template match="gsf:defaultClassifierNode">
|
---|
| 44 | <xslt:call-template name="defaultClassifierNode"/>
|
---|
| 45 | </xsl:template>
|
---|
[25002] | 46 |
|
---|
| 47 | <xsl:template match="gsf:image">
|
---|
[26020] | 48 | <xsl:variable name="metaName">
|
---|
| 49 | <xsl:choose>
|
---|
| 50 | <xsl:when test="@type = 'thumb'">Thumb</xsl:when>
|
---|
| 51 | <xsl:when test="@type = 'screen'">Screen</xsl:when>
|
---|
| 52 | <xsl:when test="@type = 'source'">SourceFile</xsl:when>
|
---|
| 53 | </xsl:choose>
|
---|
| 54 | </xsl:variable>
|
---|
| 55 | <xsl:if test="(.//metadataList)[last()]/metadata[@name = $metaName]">
|
---|
| 56 | <img>
|
---|
| 57 | <xslt:attribute name='src'>
|
---|
| 58 | <xslt:value-of disable-output-escaping="yes" select="/page/pageResponse/collection/metadataList/metadata[@name = 'httpPath']"/>
|
---|
| 59 | <xsl:text>/index/assoc/</xsl:text>
|
---|
| 60 | <xslt:value-of disable-output-escaping="yes" select="/page/pageResponse/document/metadataList/metadata[@name = 'assocfilepath']"/>
|
---|
| 61 | <xsl:text>/</xsl:text>
|
---|
| 62 | <xsl:choose>
|
---|
| 63 | <xsl:when test="@type = 'thumb'">
|
---|
| 64 | <xslt:value-of disable-output-escaping="yes" select="(.//metadataList)[last()]/metadata[@name = 'Thumb']"/>
|
---|
| 65 | </xsl:when>
|
---|
| 66 | <xsl:when test="@type = 'screen'">
|
---|
| 67 | <xslt:value-of disable-output-escaping="yes" select="(.//metadataList)[last()]/metadata[@name = 'Screen']"/>
|
---|
| 68 | </xsl:when>
|
---|
| 69 | <xsl:when test="@type = 'source'">
|
---|
| 70 | <xslt:value-of disable-output-escaping="yes" select="(.//metadataList)[last()]/metadata[@name = 'SourceFile']"/>
|
---|
| 71 | </xsl:when>
|
---|
| 72 | </xsl:choose>
|
---|
| 73 | </xslt:attribute>
|
---|
| 74 | </img>
|
---|
| 75 | </xsl:if>
|
---|
[25002] | 76 | </xsl:template>
|
---|
| 77 |
|
---|
[24115] | 78 | <xsl:template match="gsf:link">
|
---|
| 79 | <xsl:choose>
|
---|
| 80 | <xsl:when test="@type='classifier'">
|
---|
| 81 | <a>
|
---|
| 82 | <xslt:attribute name='href'>
|
---|
| 83 | <xslt:value-of select='$library_name'/>
|
---|
[25438] | 84 | <xsl:text>/collection/</xsl:text>
|
---|
[24115] | 85 | <xslt:value-of select='/page/pageResponse/collection/@name'/>
|
---|
[25438] | 86 | <xsl:text>/browse/</xsl:text>
|
---|
| 87 | <xslt:value-of select='util:replace(@nodeID, ".", "/")'/>
|
---|
[24115] | 88 | </xslt:attribute>
|
---|
| 89 | <xsl:apply-templates/>
|
---|
| 90 | </a>
|
---|
| 91 | </xsl:when>
|
---|
[24127] | 92 | <xsl:when test="@type='source'">
|
---|
| 93 | <a><xslt:attribute name='href'><xslt:value-of
|
---|
| 94 | disable-output-escaping="yes" select="/page/pageResponse/collection/metadataList/metadata[@name='httpPath']" />/index/assoc/<xslt:value-of
|
---|
[25177] | 95 | disable-output-escaping="yes" select="(.//metadataList)[last()]/metadata[@name='assocfilepath']" />/<xslt:value-of
|
---|
| 96 | disable-output-escaping="yes" select="(.//metadataList)[last()]/metadata[@name='srclinkFile']" /></xslt:attribute>
|
---|
[24127] | 97 | <xsl:apply-templates/>
|
---|
| 98 | </a>
|
---|
| 99 | </xsl:when>
|
---|
[24115] | 100 | <xsl:otherwise> <!-- a document link -->
|
---|
| 101 | <xslt:variable name="bookswitch">
|
---|
| 102 | <xslt:value-of select="/page/pageRequest/paramList/param[@name='book']/@value"/>
|
---|
| 103 | </xslt:variable>
|
---|
[25361] | 104 | <a>
|
---|
| 105 | <xslt:attribute name="href">
|
---|
| 106 | <xslt:value-of select='$library_name'/>
|
---|
| 107 | <xsl:text>/collection/</xsl:text>
|
---|
| 108 | <xslt:value-of select='/page/pageResponse/collection/@name'/>
|
---|
| 109 | <xsl:text>/document/</xsl:text>
|
---|
| 110 | <xslt:value-of select='@nodeID'/>
|
---|
[25919] | 111 | <xslt:choose>
|
---|
| 112 | <xslt:when test="$bookswitch = 'on' or $bookswitch = 'flashxml'">
|
---|
| 113 | <xsl:text>?book=on</xsl:text>
|
---|
| 114 | </xslt:when>
|
---|
| 115 | <xslt:otherwise>
|
---|
| 116 | <xslt:if test="$opt-doc-link-args">?<xslt:value-of select="$opt-doc-link-args"/></xslt:if>
|
---|
| 117 | </xslt:otherwise>
|
---|
| 118 | </xslt:choose>
|
---|
[25361] | 119 | </xslt:attribute>
|
---|
| 120 | <xsl:apply-templates/>
|
---|
| 121 | </a>
|
---|
[24115] | 122 | </xsl:otherwise>
|
---|
| 123 | </xsl:choose>
|
---|
| 124 | </xsl:template>
|
---|
[19860] | 125 |
|
---|
[24115] | 126 | <xsl:template match="gsf:icon">
|
---|
| 127 | <xsl:choose>
|
---|
| 128 | <xsl:when test="@type='classifier'">
|
---|
[24458] | 129 | <img style="border:0px"><xsl:attribute name="src"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'bookshelf_image')"/></xsl:attribute></img>
|
---|
[24115] | 130 | </xsl:when>
|
---|
[25361] | 131 | <xsl:when test="not(@type) or @type='document'">
|
---|
[24510] | 132 | <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] | 133 | </xsl:when>
|
---|
| 134 | </xsl:choose>
|
---|
| 135 | </xsl:template>
|
---|
[25941] | 136 |
|
---|
| 137 | <!-- gsf:cgiparam example, as used by the Enhanced PDF tutorial:
|
---|
| 138 | <a><xsl:attribute name="href"><gsf:metadata name="httpPath" type="collection"/>/index/assoc/<gsf:metadata name="archivedir"/>/<gsf:metadata name="srclinkFile"/>#search=&quot;<gsf:cgi-param name="query"/>&quot;</xsl:attribute>src doc link with query highlighting</a> -->
|
---|
| 139 | <xsl:template match="gsf:cgi-param">
|
---|
| 140 | <xslt:value-of disable-output-escaping="yes" select="/page/pageRequest/paramList/param[@name='s1.{@name}']/@value"/>
|
---|
| 141 | </xsl:template>
|
---|
[24359] | 142 |
|
---|
[25752] | 143 | <!-- A GLI user can use a gsf:displayText element in GS3's Format Features to retrieve
|
---|
| 144 | a string defined in either collectionConfig.xml or else the interface dictionaries.
|
---|
| 145 | If the requested string occurs in neither, the request string itself will be output. -->
|
---|
[25732] | 146 | <xsl:template match="gsf:displayText">
|
---|
[25752] | 147 | <xslt:variable name="displaytext">
|
---|
| 148 | <xsl:call-template name="gsf:displayItem"/>
|
---|
| 149 | </xslt:variable>
|
---|
| 150 |
|
---|
| 151 | <xslt:choose>
|
---|
| 152 | <xslt:when test="$displaytext != ''">
|
---|
| 153 | <xslt:value-of disable-output-escaping="yes" select="$displaytext"/>
|
---|
| 154 | </xslt:when>
|
---|
| 155 | <xslt:otherwise>
|
---|
| 156 | <xslt:variable name="interfacetxt">
|
---|
| 157 | <xsl:call-template name="gsf:interfaceText"/>
|
---|
| 158 | </xslt:variable>
|
---|
| 159 |
|
---|
| 160 | <xslt:choose>
|
---|
| 161 | <xslt:when test="$interfacetxt != ''">
|
---|
| 162 | <xslt:value-of disable-output-escaping="yes" select="$interfacetxt"/>
|
---|
| 163 | </xslt:when>
|
---|
| 164 | <xslt:otherwise>
|
---|
| 165 | <xslt:value-of disable-output-escaping="yes" select="'{@name}'"/>
|
---|
| 166 | </xslt:otherwise>
|
---|
| 167 | </xslt:choose>
|
---|
| 168 | </xslt:otherwise>
|
---|
| 169 | </xslt:choose>
|
---|
| 170 | </xsl:template>
|
---|
| 171 |
|
---|
| 172 | <!-- With gsf:displayItem, a user can request a displayItem from collectionConfig.xml -->
|
---|
| 173 | <xsl:template match="gsf:displayItem" name="gsf:displayItem">
|
---|
[25732] | 174 | <xslt:value-of disable-output-escaping="yes" select="/page/pageResponse/collection/displayItem[@name='{@name}']"/>
|
---|
| 175 | </xsl:template>
|
---|
| 176 |
|
---|
[25752] | 177 | <!-- With gsf:interfaceText, a user can request a string from the interface dictionaries in the current lang -->
|
---|
| 178 | <xsl:template match="gsf:interfaceText" name="gsf:interfaceText">
|
---|
[25732] | 179 | <xslt:value-of disable-output-escaping="yes" select="util:getInterfaceText($interface_name, /page/@lang, '{@name}')"/>
|
---|
| 180 | </xsl:template>
|
---|
| 181 |
|
---|
[24792] | 182 | <!-- if this gsf:metadata is a child of a document node then we want to get the metadata for that node -->
|
---|
[25145] | 183 | <xsl:template match="gsf:metadata">
|
---|
[25928] | 184 | <xslt:variable name="langAtt"><xsl:value-of select="@lang"/></xslt:variable>
|
---|
| 185 | <xslt:if test="not(@hidden = 'true')">
|
---|
[25002] | 186 | <xslt:value-of disable-output-escaping="yes">
|
---|
| 187 | <xsl:attribute name="select">
|
---|
[25145] | 188 | <xsl:if test="@format">
|
---|
| 189 | <xsl:text>java:org.greenstone.gsdl3.util.XSLTUtil.</xsl:text>
|
---|
| 190 | <xsl:value-of select="@format"/>
|
---|
| 191 | <xsl:text>(</xsl:text>
|
---|
| 192 | </xsl:if>
|
---|
[25928] | 193 | <xsl:choose>
|
---|
| 194 | <xsl:when test="@type = 'collection'">
|
---|
| 195 | <xsl:text>/page/pageResponse/collection/metadataList/metadata[@name='</xsl:text>
|
---|
| 196 | </xsl:when>
|
---|
| 197 | <xsl:otherwise>
|
---|
| 198 | <xsl:text>(.//metadataList)[last()]/metadata[@name='</xsl:text>
|
---|
| 199 | </xsl:otherwise>
|
---|
| 200 | </xsl:choose>
|
---|
[25002] | 201 | <xsl:apply-templates select="." mode="get-metadata-name"/>
|
---|
[25928] | 202 | <xsl:text>'</xsl:text>
|
---|
| 203 | <xsl:if test="@lang">
|
---|
| 204 | <xsl:text> and @lang=$langAtt</xsl:text>
|
---|
| 205 | </xsl:if>
|
---|
| 206 | <xsl:text>]</xsl:text>
|
---|
[25145] | 207 | <xsl:if test="@format">
|
---|
| 208 | <xsl:text>, /page/@lang )</xsl:text>
|
---|
| 209 | </xsl:if>
|
---|
[25002] | 210 | </xsl:attribute>
|
---|
| 211 | </xslt:value-of>
|
---|
| 212 | </xslt:if>
|
---|
[24792] | 213 | </xsl:template>
|
---|
[19860] | 214 |
|
---|
[24115] | 215 | <xsl:template match="gsf:metadata" mode="get-metadata-name">
|
---|
[25805] | 216 | <xsl:if test="@pos">
|
---|
| 217 | <xsl:text>pos</xsl:text>
|
---|
| 218 | <xsl:value-of select='@pos'/>
|
---|
| 219 | <xsl:text>_</xsl:text>
|
---|
| 220 | </xsl:if>
|
---|
| 221 | <xsl:if test='@select'>
|
---|
| 222 | <xsl:value-of select='@select'/>
|
---|
| 223 | <xsl:text>_</xsl:text>
|
---|
| 224 | </xsl:if>
|
---|
| 225 | <xsl:if test="@separator">
|
---|
| 226 | <xsl:text>*</xsl:text>
|
---|
| 227 | <xsl:value-of select='@separator'/>
|
---|
| 228 | <xsl:text>*_</xsl:text>
|
---|
| 229 | </xsl:if>
|
---|
| 230 | <xsl:value-of select="@name"/>
|
---|
| 231 | </xsl:template>
|
---|
| 232 |
|
---|
| 233 | <xsl:template match="gsf:metadata-old" mode="get-metadata-name">
|
---|
[24115] | 234 | <xsl:if test="@multiple='true'">
|
---|
| 235 | <xsl:text>all_</xsl:text>
|
---|
| 236 | </xsl:if>
|
---|
| 237 | <xsl:if test='@select'>
|
---|
| 238 | <xsl:value-of select='@select'/>
|
---|
| 239 | <xsl:text>_</xsl:text>
|
---|
| 240 | </xsl:if>
|
---|
| 241 | <xsl:if test="@separator">
|
---|
[25805] | 242 | <xsl:text>*</xsl:text>
|
---|
[24115] | 243 | <xsl:value-of select='@separator'/>
|
---|
| 244 | <xsl:text>*_</xsl:text>
|
---|
| 245 | </xsl:if>
|
---|
| 246 | <xsl:value-of select="@name"/>
|
---|
| 247 | </xsl:template>
|
---|
[19860] | 248 |
|
---|
[25805] | 249 | <xsl:template match="gsf:metadata-older">
|
---|
[24115] | 250 | <xslt:value-of disable-output-escaping="yes">
|
---|
| 251 | <xsl:attribute name="select">
|
---|
[25177] | 252 | <xsl:text>(.//metadataList)[last()]/metadata[@name="</xsl:text>
|
---|
[24115] | 253 | <xsl:choose>
|
---|
| 254 | <xsl:when test="@select='parent'">
|
---|
| 255 | <xsl:text>parent_</xsl:text>
|
---|
| 256 | </xsl:when>
|
---|
| 257 | <xsl:when test="@select='root'">
|
---|
| 258 | <xsl:text>root_</xsl:text>
|
---|
| 259 | </xsl:when>
|
---|
| 260 | <xsl:when test="@select='ancestors'">
|
---|
| 261 | <xsl:text>ancestors'</xsl:text>
|
---|
| 262 | <xsl:value-of select='@separator'/>
|
---|
| 263 | <xsl:text>'_</xsl:text>
|
---|
| 264 | </xsl:when>
|
---|
| 265 | <xsl:when test="@select='siblings'">
|
---|
| 266 | <xsl:text>siblings_'</xsl:text>
|
---|
| 267 | <xsl:value-of select='@separator'/>
|
---|
| 268 | <xsl:text>'_</xsl:text>
|
---|
| 269 | </xsl:when>
|
---|
| 270 | </xsl:choose>
|
---|
| 271 | <xsl:value-of select="@name"/>
|
---|
| 272 | <xsl:text>"]</xsl:text>
|
---|
| 273 | </xsl:attribute>
|
---|
| 274 | </xslt:value-of>
|
---|
| 275 | </xsl:template>
|
---|
[19860] | 276 |
|
---|
[24115] | 277 | <xsl:template match="gsf:text">
|
---|
[26020] | 278 | <xslt:call-template name="documentNodeText"/>
|
---|
[24115] | 279 | </xsl:template>
|
---|
[19860] | 280 |
|
---|
[24792] | 281 | <xsl:template match="gsf:choose-metadata">
|
---|
| 282 | <xslt:choose>
|
---|
| 283 | <xsl:for-each select="gsf:metadata">
|
---|
| 284 | <xslt:when>
|
---|
[25177] | 285 | <xsl:attribute name="test">(.//metadataList)[last()]/metadata[@name='<xsl:apply-templates select="." mode="get-metadata-name"/>']</xsl:attribute>
|
---|
[24792] | 286 | <xsl:apply-templates select="."/>
|
---|
| 287 | </xslt:when>
|
---|
| 288 | </xsl:for-each>
|
---|
| 289 | <xsl:if test="gsf:default">
|
---|
| 290 | <xslt:otherwise><xsl:apply-templates select="gsf:default"/></xslt:otherwise>
|
---|
| 291 | </xsl:if>
|
---|
| 292 | </xslt:choose>
|
---|
| 293 | </xsl:template>
|
---|
[19860] | 294 |
|
---|
[24115] | 295 | <xsl:template match="gsf:switch">
|
---|
| 296 | <xsl:variable name="meta-name"><xsl:apply-templates select="gsf:metadata" mode="get-metadata-name"/></xsl:variable>
|
---|
[25177] | 297 | <xslt:variable name="meta"><xsl:choose><xsl:when test="@preprocess"><xslt:value-of select="util:{@preprocess}((.//metadataList)[last()]/metadata[@name='{$meta-name}'])"/></xsl:when><xsl:otherwise><xslt:value-of select="(.//metadataList)[last()]/metadata[@name='{$meta-name}']"/></xsl:otherwise></xsl:choose></xslt:variable>
|
---|
[24115] | 298 | <xslt:choose>
|
---|
| 299 | <xsl:for-each select="gsf:when">
|
---|
| 300 | <xslt:when test="util:{@test}($meta, '{@test-value}')">
|
---|
| 301 | <xsl:apply-templates/>
|
---|
| 302 | </xslt:when>
|
---|
| 303 | </xsl:for-each>
|
---|
| 304 | <xsl:if test="gsf:otherwise">
|
---|
| 305 | <xslt:otherwise>
|
---|
| 306 | <xsl:apply-templates select="gsf:otherwise/node()"/>
|
---|
| 307 | </xslt:otherwise>
|
---|
| 308 | </xsl:if>
|
---|
| 309 | </xslt:choose>
|
---|
| 310 | </xsl:template>
|
---|
[19860] | 311 |
|
---|
[24115] | 312 | <xsl:template match="*">
|
---|
| 313 | <xsl:copy>
|
---|
| 314 | <xsl:copy-of select="@*"/>
|
---|
| 315 | <xsl:apply-templates/>
|
---|
| 316 | </xsl:copy>
|
---|
| 317 | </xsl:template>
|
---|
[19860] | 318 |
|
---|
| 319 | </xsl:stylesheet>
|
---|
| 320 |
|
---|
| 321 |
|
---|