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