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