[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"
|
---|
[29093] | 7 | xmlns:xalan="http://xml.apache.org/xalan"
|
---|
[24115] | 8 | xmlns:util="xalan://org.greenstone.gsdl3.util.XSLTUtil"
|
---|
[29093] | 9 | extension-element-prefixes="java xalan">
|
---|
[24458] | 10 | <xsl:param name="interface_name"/>
|
---|
| 11 | <xsl:param name="library_name"/>
|
---|
[26326] | 12 | <xsl:param name="site_name"/>
|
---|
| 13 | <xsl:param name="collName"/>
|
---|
[26460] | 14 |
|
---|
[24115] | 15 | <xsl:output method="xml"/>
|
---|
| 16 | <xsl:namespace-alias stylesheet-prefix="xslt" result-prefix="xsl"/>
|
---|
[19860] | 17 |
|
---|
[29035] | 18 | <!-- don't output anything for gsf:format-gs2 elements,
|
---|
| 19 | they just exist in collectionconfig files to keep the XML valid -->
|
---|
| 20 | <xsl:template match="gsf:format-gs2" />
|
---|
| 21 |
|
---|
[24115] | 22 | <xsl:template match="format">
|
---|
| 23 | <format>
|
---|
| 24 | <xsl:apply-templates/>
|
---|
| 25 | </format>
|
---|
| 26 | </xsl:template>
|
---|
[26460] | 27 |
|
---|
[24115] | 28 | <xsl:template match="gsf:template">
|
---|
| 29 | <xslt:template>
|
---|
| 30 | <xsl:copy-of select="@*"/>
|
---|
| 31 | <xsl:attribute name="priority">2</xsl:attribute>
|
---|
| 32 | <xsl:if test=".//gsf:link">
|
---|
| 33 | <xslt:param name="serviceName"/>
|
---|
| 34 | <xslt:param name="collName"/>
|
---|
| 35 | </xsl:if>
|
---|
| 36 | <xsl:apply-templates/>
|
---|
| 37 | </xslt:template>
|
---|
| 38 | </xsl:template>
|
---|
[26460] | 39 |
|
---|
[24458] | 40 | <xsl:template match="gsf:variable">
|
---|
| 41 | <xslt:variable>
|
---|
| 42 | <xsl:copy-of select="@*"/>
|
---|
| 43 | <xsl:apply-templates/>
|
---|
| 44 | </xslt:variable>
|
---|
| 45 | <script type="text/javascript">
|
---|
[26500] | 46 | gs.variables.<xsl:value-of select="@name"/>
|
---|
| 47 | <xslt:text disable-output-escaping="yes"> = "</xslt:text>
|
---|
| 48 | <xsl:apply-templates/>
|
---|
[26460] | 49 | <xslt:text disable-output-escaping="yes">";</xslt:text>
|
---|
[24458] | 50 | </script>
|
---|
| 51 | </xsl:template>
|
---|
[26460] | 52 |
|
---|
[28749] | 53 |
|
---|
| 54 | <xsl:template match="gsf:variable2">
|
---|
| 55 | <xslt:variable>
|
---|
| 56 | <xsl:copy-of select="@*"/>
|
---|
| 57 | <xsl:apply-templates/>
|
---|
| 58 | </xslt:variable>
|
---|
| 59 | <script type="text/javascript">
|
---|
| 60 | gs.variables.<xsl:value-of select="@name"/>
|
---|
| 61 | <xslt:text disable-output-escaping="yes"> = '</xslt:text>
|
---|
| 62 | <xsl:apply-templates/>
|
---|
| 63 | <xslt:text disable-output-escaping="yes">';</xslt:text>
|
---|
| 64 | </script>
|
---|
| 65 | </xsl:template>
|
---|
| 66 |
|
---|
[24792] | 67 | <xsl:template match="gsf:defaultClassifierNode">
|
---|
| 68 | <xslt:call-template name="defaultClassifierNode"/>
|
---|
| 69 | </xsl:template>
|
---|
[25002] | 70 |
|
---|
[26439] | 71 |
|
---|
| 72 | <xsl:template match="gsf:script[@src]">
|
---|
[26460] | 73 | <script>
|
---|
| 74 | <xsl:attribute name='src'>
|
---|
| 75 | <xsl:value-of select="@src"/>
|
---|
| 76 | </xsl:attribute>
|
---|
| 77 | <xslt:attribute name='type'>text/javascript</xslt:attribute>
|
---|
| 78 | <xslt:comment/>
|
---|
| 79 | <!-- comment used to ensure script tag is not collapsed -->
|
---|
| 80 | </script>
|
---|
[26439] | 81 | </xsl:template>
|
---|
| 82 |
|
---|
| 83 |
|
---|
| 84 | <xsl:template match="gsf:script">
|
---|
[26460] | 85 | <script type="text/javascript">
|
---|
| 86 | <xslt:text disable-output-escaping="yes">
|
---|
| 87 | <xsl:apply-templates/>
|
---|
| 88 | </xslt:text>
|
---|
| 89 | </script>
|
---|
[26439] | 90 | </xsl:template>
|
---|
| 91 |
|
---|
| 92 | <xsl:template match="gsf:style[@src]">
|
---|
[26460] | 93 | <link rel="stylesheet" type="text/css">
|
---|
| 94 | <xsl:attribute name='href'>
|
---|
| 95 | <xsl:value-of select="@src"/>
|
---|
| 96 | </xsl:attribute>
|
---|
| 97 | </link>
|
---|
[26439] | 98 | </xsl:template>
|
---|
| 99 |
|
---|
| 100 | <xsl:template match="gsf:style">
|
---|
[26460] | 101 | <style type="text/css">
|
---|
| 102 | <xsl:apply-templates/>
|
---|
| 103 | </style>
|
---|
[26439] | 104 | </xsl:template>
|
---|
| 105 |
|
---|
| 106 |
|
---|
[25002] | 107 | <xsl:template match="gsf:image">
|
---|
[26022] | 108 | <xslt:variable name="metaName">
|
---|
[26020] | 109 | <xsl:choose>
|
---|
| 110 | <xsl:when test="@type = 'thumb'">Thumb</xsl:when>
|
---|
| 111 | <xsl:when test="@type = 'screen'">Screen</xsl:when>
|
---|
| 112 | <xsl:when test="@type = 'source'">SourceFile</xsl:when>
|
---|
| 113 | </xsl:choose>
|
---|
[26022] | 114 | </xslt:variable>
|
---|
| 115 | <xslt:if test="(.//metadataList)[last()]/metadata[@name = $metaName]">
|
---|
[26020] | 116 | <img>
|
---|
| 117 | <xslt:attribute name='src'>
|
---|
| 118 | <xslt:value-of disable-output-escaping="yes" select="/page/pageResponse/collection/metadataList/metadata[@name = 'httpPath']"/>
|
---|
| 119 | <xsl:text>/index/assoc/</xsl:text>
|
---|
| 120 | <xslt:value-of disable-output-escaping="yes" select="/page/pageResponse/document/metadataList/metadata[@name = 'assocfilepath']"/>
|
---|
| 121 | <xsl:text>/</xsl:text>
|
---|
[26022] | 122 | <xslt:value-of disable-output-escaping="yes" select="(.//metadataList)[last()]/metadata[@name = $metaName]"/>
|
---|
[26020] | 123 | </xslt:attribute>
|
---|
| 124 | </img>
|
---|
[26022] | 125 | </xslt:if>
|
---|
[25002] | 126 | </xsl:template>
|
---|
| 127 |
|
---|
[26500] | 128 | <xsl:template match="params"></xsl:template>
|
---|
| 129 |
|
---|
[24115] | 130 | <xsl:template match="gsf:link">
|
---|
[26467] | 131 |
|
---|
[26460] | 132 | <xslt:variable name="collName" select="/page/pageResponse/collection/@name"/>
|
---|
| 133 | <xsl:variable name="opt-title">
|
---|
| 134 | <xsl:choose>
|
---|
[26467] | 135 | <xsl:when test="@title">
|
---|
| 136 | <xslt:attribute name="title">
|
---|
| 137 | <xsl:value-of select="@title"/>
|
---|
| 138 | </xslt:attribute>
|
---|
[26460] | 139 | </xsl:when>
|
---|
[26467] | 140 | <xsl:when test="@titlekey">
|
---|
| 141 | <xslt:attribute name="title">
|
---|
| 142 | <xslt:value-of disable-output-escaping="yes" select="util:getCollectionText($collName, $site_name, /page/@lang, '{@titlekey}')"/>
|
---|
| 143 | </xslt:attribute>
|
---|
[26460] | 144 | </xsl:when>
|
---|
| 145 | </xsl:choose>
|
---|
| 146 | </xsl:variable>
|
---|
[26467] | 147 |
|
---|
[24115] | 148 | <xsl:choose>
|
---|
[26326] | 149 | <xsl:when test="@type='query'">
|
---|
| 150 | <a>
|
---|
[26504] | 151 | <xsl:if test="@target">
|
---|
| 152 | <xsl:attribute name='target'>
|
---|
| 153 | <xsl:value-of select='@target'/>
|
---|
| 154 | </xsl:attribute>
|
---|
| 155 | </xsl:if>
|
---|
| 156 |
|
---|
[26326] | 157 | <xslt:attribute name='href'>
|
---|
| 158 | <xslt:value-of select='$library_name'/>
|
---|
| 159 | <xsl:text>/collection/</xsl:text>
|
---|
| 160 | <xslt:value-of select='/page/pageResponse/collection/@name'/>
|
---|
| 161 | <xsl:text>/search/</xsl:text>
|
---|
| 162 | <xsl:choose>
|
---|
| 163 | <xsl:when test="@name">
|
---|
| 164 | <xsl:value-of select="@name"/>
|
---|
| 165 | </xsl:when>
|
---|
| 166 | <xsl:otherwise>
|
---|
| 167 | <xsl:text>TextQuery</xsl:text>
|
---|
| 168 | </xsl:otherwise>
|
---|
| 169 | </xsl:choose>
|
---|
[26467] | 170 | <xsl:if test="params">?rt=rd&<xsl:copy-of select="params/node()"/></xsl:if>
|
---|
[26326] | 171 | </xslt:attribute>
|
---|
[26460] | 172 | <xsl:copy-of select="$opt-title"/>
|
---|
[26326] | 173 | <xsl:apply-templates/>
|
---|
| 174 | </a>
|
---|
| 175 | </xsl:when>
|
---|
[24115] | 176 | <xsl:when test="@type='classifier'">
|
---|
| 177 | <a>
|
---|
[26504] | 178 | <xsl:if test="@target">
|
---|
| 179 | <xsl:attribute name='target'>
|
---|
| 180 | <xsl:value-of select='@target'/>
|
---|
| 181 | </xsl:attribute>
|
---|
| 182 | </xsl:if>
|
---|
| 183 |
|
---|
[24115] | 184 | <xslt:attribute name='href'>
|
---|
| 185 | <xslt:value-of select='$library_name'/>
|
---|
[25438] | 186 | <xsl:text>/collection/</xsl:text>
|
---|
[24115] | 187 | <xslt:value-of select='/page/pageResponse/collection/@name'/>
|
---|
[25438] | 188 | <xsl:text>/browse/</xsl:text>
|
---|
[26326] | 189 | <xsl:choose>
|
---|
| 190 | <xsl:when test="@nodeID">
|
---|
| 191 | <xsl:value-of select="@nodeID"/>
|
---|
| 192 | </xsl:when>
|
---|
| 193 | <xsl:otherwise>
|
---|
| 194 | <xslt:value-of select='util:replace(@nodeID, ".", "/")'/>
|
---|
| 195 | </xsl:otherwise>
|
---|
| 196 | </xsl:choose>
|
---|
[24115] | 197 | </xslt:attribute>
|
---|
[26460] | 198 | <xsl:copy-of select="$opt-title"/>
|
---|
[24115] | 199 | <xsl:apply-templates/>
|
---|
| 200 | </a>
|
---|
| 201 | </xsl:when>
|
---|
[24127] | 202 | <xsl:when test="@type='source'">
|
---|
[29234] | 203 | <xslt:variable name="thisAssocfilepath">
|
---|
| 204 | <xslt:choose>
|
---|
| 205 | <xslt:when test="/page/pageResponse/document">
|
---|
| 206 | <xslt:value-of disable-output-escaping="yes" select="/page/pageResponse/document/metadataList/metadata[@name='assocfilepath']" />
|
---|
| 207 | </xslt:when>
|
---|
| 208 | <xslt:otherwise>
|
---|
| 209 | <xslt:value-of disable-output-escaping="yes" select="(.//metadataList)[last()]/metadata[@name='assocfilepath']" />
|
---|
| 210 | </xslt:otherwise>
|
---|
| 211 | </xslt:choose>
|
---|
| 212 | </xslt:variable>
|
---|
[26504] | 213 | <a>
|
---|
[29234] | 214 | <xsl:if test="@target">
|
---|
[26504] | 215 | <xsl:attribute name='target'>
|
---|
| 216 | <xsl:value-of select='@target'/>
|
---|
| 217 | </xsl:attribute>
|
---|
| 218 | </xsl:if>
|
---|
[26460] | 219 | <xslt:attribute name='href'>
|
---|
| 220 | <xslt:value-of
|
---|
[24127] | 221 | disable-output-escaping="yes" select="/page/pageResponse/collection/metadataList/metadata[@name='httpPath']" />/index/assoc/<xslt:value-of
|
---|
[29234] | 222 | disable-output-escaping="yes" select="$thisAssocfilepath" />/<xslt:value-of
|
---|
[26460] | 223 | disable-output-escaping="yes" select="(.//metadataList)[last()]/metadata[@name='srclinkFile']" />
|
---|
| 224 | </xslt:attribute>
|
---|
| 225 | <xsl:copy-of select="$opt-title"/>
|
---|
| 226 | <xsl:apply-templates/>
|
---|
[24127] | 227 | </a>
|
---|
| 228 | </xsl:when>
|
---|
[26043] | 229 | <xsl:when test="@type='web'">
|
---|
[26460] | 230 | <xslt:value-of disable-output-escaping="yes" select="metadataList/metadata[contains(@name, 'weblink')]"/>
|
---|
| 231 | <xsl:apply-templates/>
|
---|
| 232 | <xslt:value-of disable-output-escaping="yes" select="metadataList/metadata[contains(@name, '/weblink')]"/>
|
---|
[26043] | 233 | </xsl:when>
|
---|
[26326] | 234 | <xsl:when test="@type='page'">
|
---|
[26317] | 235 | <a>
|
---|
[26504] | 236 | <xsl:if test="@target">
|
---|
| 237 | <xsl:attribute name='target'>
|
---|
| 238 | <xsl:value-of select='@target'/>
|
---|
| 239 | </xsl:attribute>
|
---|
| 240 | </xsl:if>
|
---|
| 241 |
|
---|
[26317] | 242 | <xslt:attribute name='href'>
|
---|
| 243 | <xslt:value-of select='$library_name'/>
|
---|
| 244 | <xsl:text>/collection/</xsl:text>
|
---|
[26326] | 245 | <xslt:value-of select='/page/pageResponse/collection/@name'/>
|
---|
| 246 | <xsl:text>/page/</xsl:text>
|
---|
| 247 | <xsl:value-of select="@page"/>
|
---|
| 248 | </xslt:attribute>
|
---|
[26460] | 249 | <xsl:copy-of select="$opt-title"/>
|
---|
| 250 | <xsl:apply-templates/>
|
---|
[26317] | 251 | </a>
|
---|
[26326] | 252 | </xsl:when>
|
---|
[26043] | 253 | <xsl:when test="@type='equivdoc'">
|
---|
[26460] | 254 | <xsl:call-template name="gsf:equivlinkgs3"/>
|
---|
[26043] | 255 | </xsl:when>
|
---|
[27101] | 256 | <xsl:when test="@type='rss'">
|
---|
| 257 | <a>
|
---|
| 258 | <xslt:attribute name='href'>
|
---|
| 259 | <xslt:value-of select='$library_name'/>
|
---|
| 260 | <xsl:text>?a=rss&l=en&site=</xsl:text>
|
---|
| 261 | <xslt:value-of select="$site_name"/>
|
---|
| 262 | <xsl:text>&c=</xsl:text>
|
---|
| 263 | <xslt:value-of select='/page/pageResponse/collection/@name'/>
|
---|
| 264 | </xslt:attribute>
|
---|
| 265 | <xsl:apply-templates/>
|
---|
| 266 | </a>
|
---|
| 267 | </xsl:when>
|
---|
[26460] | 268 | <xsl:otherwise>
|
---|
| 269 | <!-- a document link -->
|
---|
[24115] | 270 | <xslt:variable name="bookswitch">
|
---|
| 271 | <xslt:value-of select="/page/pageRequest/paramList/param[@name='book']/@value"/>
|
---|
| 272 | </xslt:variable>
|
---|
[25361] | 273 | <a>
|
---|
[26504] | 274 | <xsl:if test="@target">
|
---|
| 275 | <xsl:attribute name='target'>
|
---|
| 276 | <xsl:value-of select='@target'/>
|
---|
| 277 | </xsl:attribute>
|
---|
| 278 | </xsl:if>
|
---|
| 279 |
|
---|
[26460] | 280 | <xsl:copy-of select="$opt-title"/>
|
---|
[25361] | 281 | <xslt:attribute name="href">
|
---|
| 282 | <xslt:value-of select='$library_name'/>
|
---|
| 283 | <xsl:text>/collection/</xsl:text>
|
---|
| 284 | <xslt:value-of select='/page/pageResponse/collection/@name'/>
|
---|
| 285 | <xsl:text>/document/</xsl:text>
|
---|
[26460] | 286 | <xsl:choose>
|
---|
| 287 | <xsl:when test="@OID">
|
---|
| 288 | <xsl:value-of select="@OID"/>
|
---|
| 289 | </xsl:when>
|
---|
| 290 | <xsl:when test="@OIDmetadata">
|
---|
| 291 | <xsl:variable name="OIDmeta" select="@OIDmetadata"/>
|
---|
| 292 | <xslt:value-of select="(.//metadataList)[last()]/metadata[@name='{$OIDmeta}']"/>
|
---|
| 293 | </xsl:when>
|
---|
| 294 | <xsl:otherwise>
|
---|
| 295 | <xslt:value-of select='@nodeID'/>
|
---|
| 296 | </xsl:otherwise>
|
---|
| 297 | </xsl:choose>
|
---|
[25919] | 298 | <xslt:choose>
|
---|
| 299 | <xslt:when test="$bookswitch = 'on' or $bookswitch = 'flashxml'">
|
---|
| 300 | <xsl:text>?book=on</xsl:text>
|
---|
| 301 | </xslt:when>
|
---|
| 302 | <xslt:otherwise>
|
---|
[26460] | 303 | <xslt:if test="$opt-doc-link-args">?<xslt:value-of select="$opt-doc-link-args"/>
|
---|
| 304 | </xslt:if>
|
---|
[25919] | 305 | </xslt:otherwise>
|
---|
| 306 | </xslt:choose>
|
---|
[25361] | 307 | </xslt:attribute>
|
---|
| 308 | <xsl:apply-templates/>
|
---|
| 309 | </a>
|
---|
[24115] | 310 | </xsl:otherwise>
|
---|
| 311 | </xsl:choose>
|
---|
| 312 | </xsl:template>
|
---|
[28036] | 313 |
|
---|
| 314 | <xsl:template match="gsf:OID">
|
---|
| 315 | <xslt:value-of select="@nodeID"/>
|
---|
| 316 | </xsl:template>
|
---|
| 317 | <xsl:template match="gsf:rank">
|
---|
| 318 | <xslt:value-of select="@rank"/>
|
---|
| 319 | </xsl:template>
|
---|
[24115] | 320 | <xsl:template match="gsf:icon">
|
---|
| 321 | <xsl:choose>
|
---|
| 322 | <xsl:when test="@type='classifier'">
|
---|
[26460] | 323 | <img style="border:0px">
|
---|
| 324 | <xsl:attribute name="src">
|
---|
| 325 | <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'bookshelf_image')"/>
|
---|
| 326 | </xsl:attribute>
|
---|
| 327 | </img>
|
---|
[24115] | 328 | </xsl:when>
|
---|
[26043] | 329 | <xsl:when test="@type='web'">
|
---|
[26460] | 330 | <xslt:value-of disable-output-escaping="yes" select="metadataList/metadata[contains(@name, 'webicon')]"/>
|
---|
[26043] | 331 | </xsl:when>
|
---|
[26121] | 332 | <xsl:when test="@file">
|
---|
[26460] | 333 | <img>
|
---|
| 334 | <xslt:attribute name='src'>
|
---|
| 335 | <xsl:choose>
|
---|
| 336 | <xsl:when test="not(@select) or @select='site'">
|
---|
| 337 | <xsl:value-of disable-output-escaping="yes" select="concat('interfaces/',$interface_name,'/images/',@file)"/>
|
---|
| 338 | </xsl:when>
|
---|
| 339 | <xsl:when test="@select='collection'">
|
---|
| 340 | <xslt:value-of disable-output-escaping="yes" select="/page/pageResponse/collection/metadataList/metadata[@name='httpPath']"/>
|
---|
| 341 | <xsl:value-of disable-output-escaping="yes" select="concat('/images/',@file)"/>
|
---|
| 342 | </xsl:when>
|
---|
| 343 | </xsl:choose>
|
---|
| 344 | </xslt:attribute>
|
---|
| 345 | </img>
|
---|
[26121] | 346 | </xsl:when>
|
---|
[25361] | 347 | <xsl:when test="not(@type) or @type='document'">
|
---|
[26460] | 348 | <img style="border:0px">
|
---|
| 349 | <xslt:attribute name="id">documentBasketBook<xslt:value-of select="/page/pageResponse/collection/@name"/>:<xslt:value-of select="@nodeID"/>
|
---|
| 350 | </xslt:attribute>
|
---|
| 351 | <xslt:attribute name="src">
|
---|
| 352 | <xslt:choose>
|
---|
| 353 | <xslt:when test="@docType='hierarchy' and @nodeType='root'">
|
---|
| 354 | <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'book_image')"/>
|
---|
| 355 | </xslt:when>
|
---|
| 356 | <xslt:otherwise>
|
---|
| 357 | <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'page_icon_image')"/>
|
---|
| 358 | </xslt:otherwise>
|
---|
| 359 | </xslt:choose>
|
---|
| 360 | </xslt:attribute>
|
---|
| 361 | </img>
|
---|
[24115] | 362 | </xsl:when>
|
---|
| 363 | </xsl:choose>
|
---|
| 364 | </xsl:template>
|
---|
[26460] | 365 |
|
---|
| 366 | <!-- calls a template in gslib.xsl in order to avoid xsl vs xslt issue -->
|
---|
| 367 | <!--<xsl:template match="gsf:equivlinkgs3">
|
---|
[26023] | 368 | <xslt:call-template name="equivDocLinks">
|
---|
| 369 | <xslt:with-param name="count" select="0"/>
|
---|
| 370 | </xslt:call-template>
|
---|
[26031] | 371 | </xsl:template>-->
|
---|
[26023] | 372 |
|
---|
[26460] | 373 | <!-- Another way (also works with DSpace tutorial): build all the equivalent document links for the current document in one go. No looping necessary: handled in function call. -->
|
---|
| 374 | <xsl:template match="gsf:equivlinkgs3" name="gsf:equivlinkgs3">
|
---|
| 375 | <xslt:variable name="docicon" select="metadataList/metadata[contains(@name, 'equivDocIcon')]"/>
|
---|
| 376 | <xslt:variable name="docStartlink" select="metadataList/metadata[contains(@name, 'all_*,*_equivDocLink')]"/>
|
---|
| 377 | <xslt:variable name="docEndlink" select="metadataList/metadata[contains(@name, '/equivDocLink')]"/>
|
---|
[26023] | 378 |
|
---|
[26460] | 379 | <xslt:variable name="equivDocLinks" select="java:org.greenstone.gsdl3.util.XSLTUtil.getEquivDocLinks(',',$docicon, $docStartlink, $docEndlink, ' ')" />
|
---|
| 380 | <xslt:value-of disable-output-escaping="yes" select="$equivDocLinks"/>
|
---|
| 381 | </xsl:template>
|
---|
[26023] | 382 |
|
---|
[26460] | 383 | <!--
|
---|
[26023] | 384 | In the collection's format statement, could have the following javascript+XSLT in place of
|
---|
| 385 | the gsf:equivlinkgs3 element (which resolves to the XSLT in config_format.xsl and gslib.xsl).
|
---|
| 386 | <xsl:text disable-output-escaping="yes"><script>var equivDocIcon= [ "
|
---|
| 387 | </xsl:text>
|
---|
| 388 | <gsf:metadata name="equivDocIcon" separator="", "" multiple="true"/>
|
---|
| 389 | <xsl:text disable-output-escaping="yes">"];var equivDocStartLink= [ "
|
---|
| 390 | </xsl:text>
|
---|
| 391 | <gsf:metadata name="equivDocLink" separator="","" multiple="true"/>
|
---|
| 392 | <xsl:text disable-output-escaping="yes">"];var equivDocEndLink= [ "
|
---|
| 393 | </xsl:text>
|
---|
| 394 | <gsf:metadata name="/equivDocLink" separator="","" multiple="true"/>
|
---|
| 395 | <xsl:text disable-output-escaping="yes">"];for (var i=0; i<equivDocIcon.length; i++) { document.write(equivDocStartLink[i]+ equivDocIcon[i] + equivDocEndLink[i]); }</script>
|
---|
| 396 | </xsl:text>
|
---|
| 397 | -->
|
---|
| 398 |
|
---|
[25941] | 399 | <!-- gsf:cgiparam example, as used by the Enhanced PDF tutorial:
|
---|
| 400 | <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> -->
|
---|
| 401 | <xsl:template match="gsf:cgi-param">
|
---|
| 402 | <xslt:value-of disable-output-escaping="yes" select="/page/pageRequest/paramList/param[@name='s1.{@name}']/@value"/>
|
---|
| 403 | </xsl:template>
|
---|
[24359] | 404 |
|
---|
[25752] | 405 | <!-- A GLI user can use a gsf:displayText element in GS3's Format Features to retrieve
|
---|
| 406 | a string defined in either collectionConfig.xml or else the interface dictionaries.
|
---|
| 407 | If the requested string occurs in neither, the request string itself will be output. -->
|
---|
[25732] | 408 | <xsl:template match="gsf:displayText">
|
---|
[26460] | 409 | <xslt:variable name="displaytext">
|
---|
| 410 | <xsl:call-template name="gsf:displayItem"/>
|
---|
| 411 | </xslt:variable>
|
---|
[25752] | 412 |
|
---|
[26460] | 413 | <xslt:choose>
|
---|
| 414 | <xslt:when test="$displaytext != ''">
|
---|
| 415 | <xslt:value-of disable-output-escaping="yes" select="$displaytext"/>
|
---|
| 416 | </xslt:when>
|
---|
| 417 | <xslt:otherwise>
|
---|
| 418 | <xslt:variable name="interfacetxt">
|
---|
| 419 | <xsl:call-template name="gsf:interfaceText"/>
|
---|
| 420 | </xslt:variable>
|
---|
[25752] | 421 |
|
---|
[26460] | 422 | <xslt:choose>
|
---|
| 423 | <xslt:when test="$interfacetxt != ''">
|
---|
| 424 | <xslt:value-of disable-output-escaping="yes" select="$interfacetxt"/>
|
---|
| 425 | </xslt:when>
|
---|
| 426 | <xslt:otherwise>
|
---|
| 427 | <xslt:value-of disable-output-escaping="yes" select="'{@name}'"/>
|
---|
| 428 | </xslt:otherwise>
|
---|
| 429 | </xslt:choose>
|
---|
| 430 | </xslt:otherwise>
|
---|
| 431 | </xslt:choose>
|
---|
[25752] | 432 | </xsl:template>
|
---|
| 433 |
|
---|
| 434 | <!-- With gsf:displayItem, a user can request a displayItem from collectionConfig.xml -->
|
---|
| 435 | <xsl:template match="gsf:displayItem" name="gsf:displayItem">
|
---|
[26460] | 436 | <xslt:value-of disable-output-escaping="yes" select="/page/pageResponse/collection/displayItem[@name='{@name}']"/>
|
---|
[25732] | 437 | </xsl:template>
|
---|
| 438 |
|
---|
[25752] | 439 | <!-- With gsf:interfaceText, a user can request a string from the interface dictionaries in the current lang -->
|
---|
| 440 | <xsl:template match="gsf:interfaceText" name="gsf:interfaceText">
|
---|
[26460] | 441 | <xslt:value-of disable-output-escaping="yes" select="util:getInterfaceText($interface_name, /page/@lang, '{@name}')"/>
|
---|
[25732] | 442 | </xsl:template>
|
---|
[26250] | 443 | <!-- With gsf:collectionText, a user can request a string from the collection's dictionary in the current lang -->
|
---|
| 444 | <xsl:template match="gsf:collectionText" name="gsf:collectionText">
|
---|
[26460] | 445 | <xslt:variable name="collName" select="/page/pageResponse/collection/@name"/>
|
---|
[26387] | 446 | <xslt:copy-of select="util:getCollectionText($collName, $site_name, /page/@lang, '{@name}', '{@args}')/node()"/>
|
---|
[26250] | 447 | </xsl:template>
|
---|
[25732] | 448 |
|
---|
[24792] | 449 | <!-- if this gsf:metadata is a child of a document node then we want to get the metadata for that node -->
|
---|
[26176] | 450 | <xsl:template match="gsf:metadata">
|
---|
| 451 | <xsl:if test="not(@hidden = 'true')">
|
---|
| 452 | <!-- set hidden=true on a gsf:metadata so that it gets retrieved from the server but not displayed -->
|
---|
[29245] | 453 | <xsl:variable name="meta_test"><xsl:call-template name="getMetadataTest"/></xsl:variable>
|
---|
[26176] | 454 | <xsl:variable name="separator">
|
---|
| 455 | <xsl:choose>
|
---|
[26460] | 456 | <xsl:when test="@separator">
|
---|
[29271] | 457 | <xsl:choose>
|
---|
| 458 | <xsl:when test="@separator = ' '">
|
---|
| 459 | <!-- http://stackoverflow.com/questions/1461649/how-to-insert-nbsp-in-xslt -->
|
---|
| 460 | <xsl:text> </xsl:text>
|
---|
| 461 | <!--<xsl:text> </xsl:text> only works in GLI's Format panel-->
|
---|
| 462 | <!--<xsl:text disable-output-escaping="yes"><![CDATA[ ]]></xsl:text>-->
|
---|
| 463 | </xsl:when>
|
---|
| 464 | <xsl:otherwise>
|
---|
| 465 | <xsl:value-of disable-output-escaping='yes' select="@separator"/>
|
---|
| 466 | </xsl:otherwise>
|
---|
| 467 | </xsl:choose>
|
---|
[26460] | 468 | </xsl:when>
|
---|
| 469 | <xsl:when test="separator">
|
---|
| 470 | <xsl:copy-of select="separator/node()"/>
|
---|
| 471 | </xsl:when>
|
---|
| 472 | <xsl:otherwise>
|
---|
| 473 | <xsl:text>, </xsl:text>
|
---|
| 474 | </xsl:otherwise>
|
---|
[26176] | 475 | </xsl:choose>
|
---|
| 476 | </xsl:variable>
|
---|
| 477 | <xsl:variable name="prefix">
|
---|
| 478 | <xsl:choose>
|
---|
[26460] | 479 | <xsl:when test="@prefix">
|
---|
| 480 | <xsl:value-of disable-output-escaping='yes' select="@prefix"/>
|
---|
| 481 | </xsl:when>
|
---|
| 482 | <xsl:when test="prefix">
|
---|
| 483 | <xsl:copy-of select="prefix/node()"/>
|
---|
| 484 | </xsl:when>
|
---|
[26176] | 485 | </xsl:choose>
|
---|
| 486 | </xsl:variable>
|
---|
| 487 | <xsl:variable name="suffix">
|
---|
| 488 | <xsl:choose>
|
---|
[26460] | 489 | <xsl:when test="@suffix">
|
---|
| 490 | <xsl:value-of disable-output-escaping='yes' select="@suffix"/>
|
---|
| 491 | </xsl:when>
|
---|
| 492 | <xsl:when test="suffix">
|
---|
| 493 | <xsl:copy-of select="suffix/node()"/>
|
---|
| 494 | </xsl:when>
|
---|
[26176] | 495 | </xsl:choose>
|
---|
| 496 | </xsl:variable>
|
---|
| 497 | <xsl:variable name="postest">
|
---|
| 498 | <xsl:choose>
|
---|
| 499 | <xsl:when test="@pos = 'first'">position()=1</xsl:when>
|
---|
| 500 | <xsl:when test="@pos = 'last'">position() = last()</xsl:when>
|
---|
[29091] | 501 | <xsl:when test="@pos = 'classifiedBy'">position() = number(../../@mdoffset)+1</xsl:when>
|
---|
[26460] | 502 | <xsl:when test="@pos">position() = <xsl:value-of select="@pos"/>
|
---|
| 503 | </xsl:when>
|
---|
[26176] | 504 | <xsl:otherwise>true()</xsl:otherwise>
|
---|
| 505 | </xsl:choose>
|
---|
| 506 | </xsl:variable>
|
---|
| 507 | <xsl:variable name="multiple">
|
---|
| 508 | <xsl:choose>
|
---|
| 509 | <xsl:when test="@pos">false()</xsl:when>
|
---|
| 510 | <xsl:otherwise>true()</xsl:otherwise>
|
---|
| 511 | </xsl:choose>
|
---|
| 512 | </xsl:variable>
|
---|
| 513 | <xslt:for-each>
|
---|
| 514 | <xsl:attribute name="select">
|
---|
[29093] | 515 | (<xsl:if test="@type='collection'">/page/pageResponse/collection/</xsl:if>.//metadataList)[last()]/metadata[<xsl:value-of select="$meta_test"/><xsl:if test="@lang">
|
---|
[26460] | 516 | <xsl:text> and @lang=</xsl:text>
|
---|
| 517 | <xsl:value-of select="@lang"/>
|
---|
| 518 | </xsl:if>
|
---|
| 519 | <xsl:text>]</xsl:text>
|
---|
[26176] | 520 | </xsl:attribute>
|
---|
| 521 | <xslt:if test="{$postest}">
|
---|
[26460] | 522 | <xslt:if test="{$multiple} and position()>1"><xsl:copy-of select="$separator"/>
|
---|
| 523 | </xslt:if>
|
---|
[26176] | 524 | <xsl:copy-of select="$prefix"/>
|
---|
| 525 | <xsl:choose>
|
---|
| 526 | <xsl:when test="@format">
|
---|
| 527 | <xslt:value-of disable-output-escaping='yes' select="util:{@format}(., /page/@lang )"/>
|
---|
| 528 | </xsl:when>
|
---|
| 529 | <xsl:otherwise>
|
---|
| 530 | <xslt:value-of disable-output-escaping='yes' select="."/>
|
---|
| 531 | </xsl:otherwise>
|
---|
| 532 | </xsl:choose>
|
---|
| 533 | </xslt:if>
|
---|
| 534 | <xsl:copy-of select="$suffix"/>
|
---|
| 535 | </xslt:for-each>
|
---|
| 536 | </xsl:if>
|
---|
| 537 | </xsl:template>
|
---|
[26092] | 538 |
|
---|
[26500] | 539 |
|
---|
[26467] | 540 | <xsl:template match="gsf:foreach-metadata">
|
---|
| 541 | <xsl:variable name="meta_name"><xsl:call-template name="getMetadataName"/></xsl:variable>
|
---|
| 542 | <xslt:for-each>
|
---|
| 543 | <xsl:attribute name="select">
|
---|
[28307] | 544 | (<xsl:if test="@type='collection'">/page/pageResponse/collection/</xsl:if>.//metadataList)[last()]/metadata[@name='<xsl:value-of select="$meta_name"/>'<xsl:if test="@lang"><xsl:text> and @lang=</xsl:text><xsl:value-of select="@lang"/></xsl:if><xsl:text>]</xsl:text>
|
---|
[29769] | 545 | </xsl:attribute><xsl:choose><xsl:when test='@sort'><xslt:sort/></xsl:when><xsl:when test="gsf:sort"><xslt:sort><xsl:copy-of select="gsf:sort/@*"/></xslt:sort></xsl:when></xsl:choose><xsl:if test='@separator'><xslt:if test='position()>1'><xsl:value-of select='@separator'/></xslt:if></xsl:if>
|
---|
[26467] | 546 | <xsl:apply-templates/>
|
---|
| 547 | </xslt:for-each>
|
---|
| 548 | </xsl:template>
|
---|
| 549 |
|
---|
| 550 | <xsl:template match="gsf:meta-value">
|
---|
| 551 | <xslt:value-of select="."/>
|
---|
| 552 | </xsl:template>
|
---|
[26092] | 553 |
|
---|
[26500] | 554 | <xsl:template name="getMetadataName">
|
---|
| 555 | <xsl:if test='@select'>
|
---|
| 556 | <xsl:value-of select='@select'/>
|
---|
| 557 | <xsl:text>_</xsl:text>
|
---|
| 558 | </xsl:if>
|
---|
| 559 | <xsl:value-of select="@name"/>
|
---|
| 560 | </xsl:template>
|
---|
[26467] | 561 |
|
---|
[29111] | 562 | <!-- if we have metadata name="dc.Date,Date" will make a test like (@name = 'dc.Date' or @name = 'Date') -->
|
---|
[29093] | 563 | <xsl:template name="getMetadataTest">
|
---|
[29245] | 564 | <xsl:variable name="selectattr"><xsl:value-of select='@select'/></xsl:variable>
|
---|
| 565 | (<xsl:for-each select="xalan:tokenize(@name, ',')"><xsl:if test="position()!=1"> or </xsl:if>@name='<xsl:if test="$selectattr != ''"><xsl:value-of select="$selectattr"/><xsl:text>_</xsl:text></xsl:if><xsl:value-of select="."/>'</xsl:for-each>)
|
---|
[29093] | 566 | </xsl:template>
|
---|
[26500] | 567 |
|
---|
[24115] | 568 | <xsl:template match="gsf:text">
|
---|
[26020] | 569 | <xslt:call-template name="documentNodeText"/>
|
---|
[24115] | 570 | </xsl:template>
|
---|
[26387] | 571 |
|
---|
[26460] | 572 | <xsl:template match="gsf:if-metadata-exists">
|
---|
| 573 | <xsl:variable name="meta-path">
|
---|
| 574 | <xsl:for-each select="gsf:metadata">(.//metadataList)[last()]/metadata[@name='<xsl:call-template name="getMetadataName"/>']</xsl:for-each>
|
---|
| 575 | </xsl:variable>
|
---|
| 576 | <xslt:choose>
|
---|
| 577 | <xslt:when test="{$meta-path}">
|
---|
| 578 | <xsl:apply-templates select="gsf:if/node()"/>
|
---|
| 579 | </xslt:when>
|
---|
| 580 | <xsl:if test="gsf:else">
|
---|
| 581 | <xslt:otherwise>
|
---|
| 582 | <xsl:apply-templates select="gsf:else/node()"/>
|
---|
| 583 | </xslt:otherwise>
|
---|
| 584 | </xsl:if>
|
---|
| 585 | </xslt:choose>
|
---|
| 586 | </xsl:template>
|
---|
| 587 |
|
---|
[24792] | 588 | <xsl:template match="gsf:choose-metadata">
|
---|
| 589 | <xslt:choose>
|
---|
| 590 | <xsl:for-each select="gsf:metadata">
|
---|
| 591 | <xslt:when>
|
---|
[26093] | 592 | <xsl:attribute name="test">(.//metadataList)[last()]/metadata[@name='<xsl:call-template name="getMetadataName"/>']</xsl:attribute>
|
---|
[24792] | 593 | <xsl:apply-templates select="."/>
|
---|
| 594 | </xslt:when>
|
---|
| 595 | </xsl:for-each>
|
---|
| 596 | <xsl:if test="gsf:default">
|
---|
[26460] | 597 | <xslt:otherwise>
|
---|
| 598 | <xsl:apply-templates select="gsf:default"/>
|
---|
| 599 | </xslt:otherwise>
|
---|
[24792] | 600 | </xsl:if>
|
---|
| 601 | </xslt:choose>
|
---|
| 602 | </xsl:template>
|
---|
[26460] | 603 |
|
---|
[24115] | 604 | <xsl:template match="gsf:switch">
|
---|
[26460] | 605 | <xsl:variable name="meta-name">
|
---|
| 606 | <xsl:for-each select="gsf:metadata">
|
---|
| 607 | <xsl:call-template name="getMetadataName"/>
|
---|
| 608 | </xsl:for-each>
|
---|
| 609 | </xsl:variable>
|
---|
| 610 | <xslt:variable name="meta">
|
---|
| 611 | <xsl:choose>
|
---|
| 612 | <xsl:when test="@preprocess">
|
---|
| 613 | <xslt:value-of select="util:{@preprocess}((.//metadataList)[last()]/metadata[@name='{$meta-name}'], /page/@lang )"/>
|
---|
| 614 | </xsl:when>
|
---|
| 615 | <xsl:otherwise>
|
---|
| 616 | <xslt:value-of select="(.//metadataList)[last()]/metadata[@name='{$meta-name}']"/>
|
---|
| 617 | </xsl:otherwise>
|
---|
| 618 | </xsl:choose>
|
---|
| 619 | </xslt:variable>
|
---|
[24115] | 620 | <xslt:choose>
|
---|
| 621 | <xsl:for-each select="gsf:when">
|
---|
| 622 | <xslt:when test="util:{@test}($meta, '{@test-value}')">
|
---|
| 623 | <xsl:apply-templates/>
|
---|
| 624 | </xslt:when>
|
---|
| 625 | </xsl:for-each>
|
---|
| 626 | <xsl:if test="gsf:otherwise">
|
---|
| 627 | <xslt:otherwise>
|
---|
| 628 | <xsl:apply-templates select="gsf:otherwise/node()"/>
|
---|
| 629 | </xslt:otherwise>
|
---|
| 630 | </xsl:if>
|
---|
| 631 | </xslt:choose>
|
---|
| 632 | </xsl:template>
|
---|
[26460] | 633 |
|
---|
[26500] | 634 | <!--
|
---|
| 635 | <gsf:headMetaTags> exists for controlling the <meta name="x" content="y"> elements that appear in the HTML <head></head>
|
---|
| 636 | XPATH is used to select this item (in header.xsl). It does not need an explicit definition here in this file
|
---|
| 637 | -->
|
---|
| 638 |
|
---|
[24115] | 639 | <xsl:template match="*">
|
---|
| 640 | <xsl:copy>
|
---|
[26460] | 641 | <xsl:copy-of select="@*"/>
|
---|
[24115] | 642 | <xsl:apply-templates/>
|
---|
| 643 | </xsl:copy>
|
---|
| 644 | </xsl:template>
|
---|
[19860] | 645 |
|
---|
| 646 | </xsl:stylesheet>
|
---|
| 647 |
|
---|
| 648 |
|
---|