[19856] | 1 | <?xml version="1.0" encoding="ISO-8859-1"?>
|
---|
| 2 | <xsl:stylesheet version="1.0"
|
---|
| 3 | xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
---|
| 4 | xmlns:java="http://xml.apache.org/xslt/java"
|
---|
| 5 | xmlns:util="xalan://org.greenstone.gsdl3.util.XSLTUtil"
|
---|
| 6 | xmlns:gslib="http://www.greenstone.org/skinning"
|
---|
| 7 | xmlns:gsf="http://www.greenstone.org/greenstone3/schema/ConfigFormat"
|
---|
| 8 | extension-element-prefixes="java util"
|
---|
| 9 | exclude-result-prefixes="java util gsf">
|
---|
| 10 |
|
---|
[23989] | 11 | <!-- use the 'main' layout -->
|
---|
| 12 | <xsl:import href="layouts/main.xsl"/>
|
---|
| 13 |
|
---|
[19856] | 14 | <!-- style includes global params interface_name, library_name -->
|
---|
| 15 | <xsl:include href=".old/berrytools.xsl"/>
|
---|
[23989] | 16 | <xsl:include href="document-scripts.xsl"/>
|
---|
| 17 |
|
---|
| 18 | <xsl:variable name="bookswitch">
|
---|
| 19 | <xsl:choose>
|
---|
| 20 | <xsl:when test="/page/pageRequest/paramList/param[@name='book']/@value">
|
---|
| 21 | <xsl:value-of select="/page/pageRequest/paramList/param[@name='book']/@value"/>
|
---|
| 22 | </xsl:when>
|
---|
| 23 | <xsl:otherwise>off</xsl:otherwise>
|
---|
| 24 | </xsl:choose>
|
---|
| 25 | </xsl:variable>
|
---|
[19856] | 26 |
|
---|
[19988] | 27 | <!-- set page title -->
|
---|
| 28 | <xsl:template name="pageTitle"><gslib:documentTitle/></xsl:template>
|
---|
[19856] | 29 |
|
---|
[19988] | 30 | <!-- set page breadcrumbs -->
|
---|
[23813] | 31 | <xsl:template name="breadcrumbs">
|
---|
| 32 | <gslib:siteLink/><gslib:rightArrow/>
|
---|
| 33 | <gslib:collectionNameLinked/><gslib:rightArrow/>
|
---|
| 34 | <a>
|
---|
| 35 | <xsl:attribute name="href">
|
---|
| 36 | <xsl:value-of select="$library_name"/>?a=d&c=<xsl:value-of select="$collName"/>&d=<xsl:value-of select="/page/pageResponse/document/documentNode[1]/@nodeID"/>&dt=<xsl:value-of select="/page/pageResponse/document/documentNode/@docType"/>&p.a=b&p.s=<xsl:value-of select="/page/pageResponse/service/@name"/>
|
---|
| 37 | </xsl:attribute>
|
---|
| 38 | <xsl:variable name="documentTitleVar">
|
---|
| 39 | <gslib:documentTitle/>
|
---|
| 40 | </xsl:variable>
|
---|
[24009] | 41 | <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'doc.document')"/>
|
---|
[23813] | 42 | </a>
|
---|
| 43 | </xsl:template>
|
---|
[23989] | 44 |
|
---|
| 45 | <xsl:template match="/">
|
---|
| 46 | <xsl:choose>
|
---|
| 47 | <!-- if this is the realistic books version of the page -->
|
---|
| 48 | <xsl:when test="$bookswitch = 'flashxml'">
|
---|
| 49 | <html>
|
---|
| 50 | <body>
|
---|
| 51 | <xsl:apply-templates select="/page/pageResponse/document"/>
|
---|
| 52 | </body>
|
---|
| 53 | </html>
|
---|
| 54 | </xsl:when>
|
---|
| 55 | <!-- if this is the regular version of the page -->
|
---|
| 56 | <xsl:otherwise>
|
---|
| 57 | <xsl:apply-imports/>
|
---|
| 58 | </xsl:otherwise>
|
---|
| 59 | </xsl:choose>
|
---|
| 60 | </xsl:template>
|
---|
[19988] | 61 |
|
---|
| 62 | <!-- the page content -->
|
---|
[19856] | 63 | <xsl:template match="/page/pageResponse/document">
|
---|
[23989] | 64 | <xsl:if test="$bookswitch = 'off'">
|
---|
[24018] | 65 | <div id="bookdiv" style="visibility:hidden; height:0px; display:inline;"><xsl:text> </xsl:text></div>
|
---|
| 66 |
|
---|
| 67 | <!-- Adds the realistic books javascript if necessary ( *** in document-scripts.xsl *** ) -->
|
---|
| 68 | <xsl:if test="/page/pageResponse/collection[@name = $collName]/metadataList/metadata[@name = 'tidyoption'] = 'tidy'">
|
---|
| 69 | <xsl:call-template name="realisticBooksScript"/>
|
---|
| 70 | </xsl:if>
|
---|
| 71 |
|
---|
[23989] | 72 | <!-- Add the Javascript that adds and removes highlighting ( *** in document-scripts.xsl *** ) -->
|
---|
| 73 | <xsl:call-template name="highlightingScript"/>
|
---|
| 74 |
|
---|
| 75 | <!-- Add the Javascript that expands and collapses sections ( *** in document-scripts.xsl *** ) -->
|
---|
| 76 | <xsl:call-template name="expansionScript"/>
|
---|
| 77 |
|
---|
| 78 | <!-- show the little berries for this document -->
|
---|
| 79 | <xsl:call-template name="documentBerryForDocumentPage"/>
|
---|
[19856] | 80 |
|
---|
[23989] | 81 | <table id="rightSidebar">
|
---|
| 82 | <tr><td>
|
---|
| 83 | <xsl:call-template name="viewOptions"/>
|
---|
| 84 | </td></tr>
|
---|
| 85 | <tr><td>
|
---|
| 86 | <!-- the sidebar -->
|
---|
| 87 | <div id="contentsArea">
|
---|
| 88 | <!-- show the berry basket if it's turned on -->
|
---|
| 89 | <gslib:berryBasket/>
|
---|
[19856] | 90 |
|
---|
[23989] | 91 | <!-- the book's cover image -->
|
---|
| 92 | <div id="coverImage"><gslib:coverImage/></div>
|
---|
[19856] | 93 |
|
---|
[23989] | 94 | <!-- the contents -->
|
---|
| 95 | <div id="tableOfContents">
|
---|
| 96 | <xsl:apply-templates select="documentNode" mode="TOC"/>
|
---|
| 97 | </div>
|
---|
| 98 | </div>
|
---|
| 99 | </td></tr>
|
---|
| 100 | </table>
|
---|
| 101 | </xsl:if>
|
---|
| 102 |
|
---|
[19856] | 103 | <!-- display the document -->
|
---|
[23813] | 104 | <xsl:choose>
|
---|
[19856] | 105 | <xsl:when test="@external != ''">
|
---|
| 106 | <xsl:call-template name="externalPage">
|
---|
| 107 | <xsl:with-param name="external" select="@external"/>
|
---|
| 108 | </xsl:call-template>
|
---|
| 109 | </xsl:when>
|
---|
[23989] | 110 | <xsl:when test="$bookswitch = 'flashxml'">
|
---|
| 111 | <xsl:apply-templates mode="flashxml"/>
|
---|
| 112 | </xsl:when>
|
---|
| 113 | <xsl:when test="$bookswitch = 'on'">
|
---|
| 114 | <!-- *** in document-scripts.xsl *** -->
|
---|
[24018] | 115 | <div id="bookdiv" style="display:inline;"><xsl:text> </xsl:text></div>
|
---|
[23989] | 116 | <xsl:call-template name="realisticBooksScript"/>
|
---|
| 117 | </xsl:when>
|
---|
[19856] | 118 | <xsl:otherwise>
|
---|
[22785] | 119 | <div id="gs-document-text" class="documenttext">
|
---|
[23989] | 120 | <xsl:apply-templates select="documentNode" mode="document"/>
|
---|
[24009] | 121 | </div>
|
---|
[19856] | 122 | </xsl:otherwise>
|
---|
| 123 | </xsl:choose>
|
---|
| 124 |
|
---|
| 125 | <div class="clear"><xsl:text> </xsl:text></div>
|
---|
[23989] | 126 | </xsl:template>
|
---|
| 127 |
|
---|
| 128 | <!-- Highlight annotations if requested -->
|
---|
| 129 | <xsl:template match="annotation">
|
---|
| 130 | <xsl:choose>
|
---|
| 131 | <xsl:when test="/page/pageRequest/paramList/param[@name='hl' and @value='on']">
|
---|
| 132 | <span class="termHighlight"><xsl:value-of select="."/></span>
|
---|
| 133 | </xsl:when>
|
---|
| 134 | <xsl:otherwise>
|
---|
| 135 | <span class="noTermHighlight"><xsl:value-of select="."/></span>
|
---|
| 136 | </xsl:otherwise>
|
---|
| 137 | </xsl:choose>
|
---|
| 138 | </xsl:template>
|
---|
| 139 |
|
---|
| 140 | <!-- This template is used to display the document content -->
|
---|
| 141 | <xsl:template match="documentNode" mode="document">
|
---|
| 142 | <a name="{@nodeID}"><xsl:text> </xsl:text></a>
|
---|
| 143 | <!-- Section header -->
|
---|
| 144 | <table><tr>
|
---|
| 145 | <!-- Expand/collapse button -->
|
---|
| 146 | <td class="headerTD">
|
---|
[24009] | 147 | <img id="dtoggle{@nodeID}" onclick="toggleSection('{@nodeID}');" class="icon">
|
---|
| 148 | <xsl:attribute name="src">
|
---|
| 149 | <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'collapse_image')"/>
|
---|
[23989] | 150 | </xsl:attribute>
|
---|
[24009] | 151 | </img>
|
---|
[23989] | 152 | </td>
|
---|
| 153 |
|
---|
| 154 | <!-- Automatic section number -->
|
---|
| 155 | <td class="headerTD">
|
---|
| 156 | <p>
|
---|
| 157 | <xsl:attribute name="class"><xsl:value-of select="util:hashToDepthClass(@nodeID)"/> sectionHeader</xsl:attribute>
|
---|
| 158 |
|
---|
| 159 | <xsl:if test="util:hashToSectionId(@nodeID)">
|
---|
| 160 | <span class="sectionNumberSpan">
|
---|
| 161 | <xsl:value-of select="util:hashToSectionId(@nodeID)"/>
|
---|
| 162 | <xsl:text> </xsl:text>
|
---|
| 163 | </span>
|
---|
| 164 | </xsl:if>
|
---|
| 165 | <xsl:value-of disable-output-escaping="yes" select="metadataList/metadata[@name = 'Title']"/>
|
---|
| 166 | </p>
|
---|
| 167 | </td>
|
---|
| 168 |
|
---|
| 169 | <!-- "back to top" link -->
|
---|
| 170 | <xsl:if test="util:hashToDepthClass(@nodeID) != 'sectionHeaderDepthTitle'">
|
---|
| 171 | <td class="backToTop headerTD">
|
---|
| 172 | <a href="#top">
|
---|
[24009] | 173 | <xsl:text disable-output-escaping="yes">▲</xsl:text><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'doc.back_to_top')"/>
|
---|
[23989] | 174 | </a>
|
---|
| 175 | </td>
|
---|
| 176 | </xsl:if>
|
---|
| 177 | </tr></table>
|
---|
| 178 |
|
---|
| 179 | <!-- Section text -->
|
---|
| 180 | <div id="doc{@nodeID}" class="sectionContainer" style="display:block;">
|
---|
| 181 | <xsl:for-each select="nodeContent">
|
---|
| 182 | <xsl:for-each select="node()">
|
---|
| 183 | <xsl:choose>
|
---|
| 184 | <xsl:when test="not(name())">
|
---|
| 185 | <xsl:value-of select="." disable-output-escaping="yes"/>
|
---|
| 186 | </xsl:when>
|
---|
| 187 | <xsl:otherwise>
|
---|
| 188 | <xsl:apply-templates select="."/>
|
---|
| 189 | </xsl:otherwise>
|
---|
| 190 | </xsl:choose>
|
---|
| 191 | </xsl:for-each>
|
---|
| 192 | </xsl:for-each>
|
---|
| 193 | <xsl:if test="documentNode">
|
---|
| 194 | <xsl:apply-templates select="documentNode" mode="document"/>
|
---|
| 195 | </xsl:if>
|
---|
| 196 | </div>
|
---|
[19856] | 197 |
|
---|
| 198 | </xsl:template>
|
---|
| 199 |
|
---|
[23989] | 200 | <!-- This template is used to display the table of contents -->
|
---|
| 201 | <xsl:template match="documentNode" mode="TOC">
|
---|
[19856] | 202 |
|
---|
| 203 | <!-- check if this is the currently selected table of contents item -->
|
---|
| 204 | <xsl:variable name="isCurrent" select="nodeContent"/>
|
---|
| 205 |
|
---|
| 206 | <!-- formulate the link -->
|
---|
| 207 | <xsl:variable name="contentsLink">
|
---|
[23989] | 208 | <xsl:value-of select='$library_name'/>?a=d&c=<gslib:collectionNameShort/>&d=<xsl:value-of select='@nodeID'/><xsl:if test="documentNode">.pr</xsl:if>&sib=1
|
---|
[19856] | 209 | </xsl:variable>
|
---|
| 210 |
|
---|
[23989] | 211 | <ul>
|
---|
| 212 | <table><tr>
|
---|
| 213 | <!-- The expand/collapse button (not displayed for the top level node) -->
|
---|
| 214 | <xsl:if test="util:hashToDepthClass(@nodeID) != 'sectionHeaderDepthTitle'">
|
---|
| 215 | <td>
|
---|
| 216 | <xsl:choose>
|
---|
| 217 | <xsl:when test="not(nodeContent and not(documentNode))">
|
---|
[24009] | 218 | <img id="ttoggle{@nodeID}" onclick="toggleSection('{@nodeID}');" class="icon">
|
---|
| 219 | <xsl:attribute name="src">
|
---|
| 220 | <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'collapse_image')"/>
|
---|
| 221 | </xsl:attribute>
|
---|
| 222 | </img>
|
---|
[23989] | 223 | </xsl:when>
|
---|
| 224 | <xsl:otherwise>
|
---|
[24009] | 225 | <xsl:attribute name="class">emptyIcon</xsl:attribute>
|
---|
[23989] | 226 | </xsl:otherwise>
|
---|
| 227 | </xsl:choose>
|
---|
| 228 | </td>
|
---|
| 229 | </xsl:if>
|
---|
| 230 |
|
---|
| 231 | <!-- The chapter/page icon -->
|
---|
| 232 | <td>
|
---|
[24009] | 233 | <img>
|
---|
| 234 | <xsl:if test="nodeContent and not(documentNode)">
|
---|
| 235 | <xsl:attribute name="class">leafNode</xsl:attribute>
|
---|
| 236 | </xsl:if>
|
---|
| 237 |
|
---|
| 238 | <xsl:attribute name="src">
|
---|
[23989] | 239 | <xsl:choose>
|
---|
| 240 | <xsl:when test="nodeContent and not(documentNode)">
|
---|
[24009] | 241 | <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'page_image')"/>
|
---|
[23989] | 242 | </xsl:when>
|
---|
| 243 | <xsl:otherwise>
|
---|
[24009] | 244 | <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'chapter_image')"/>
|
---|
[23989] | 245 | </xsl:otherwise>
|
---|
| 246 | </xsl:choose>
|
---|
| 247 | </xsl:attribute>
|
---|
[24009] | 248 | </img>
|
---|
[23989] | 249 | </td>
|
---|
| 250 |
|
---|
| 251 | <!-- The section name, links to the section in the document -->
|
---|
| 252 | <td>
|
---|
| 253 | <a>
|
---|
| 254 | <xsl:attribute name="href">#<xsl:value-of select="@nodeID"/></xsl:attribute>
|
---|
| 255 | <xsl:if test="util:hashToSectionId(@nodeID)">
|
---|
| 256 | <xsl:value-of select="util:hashToSectionId(@nodeID)"/>
|
---|
| 257 | <xsl:text> </xsl:text>
|
---|
| 258 | </xsl:if>
|
---|
| 259 | <xsl:value-of disable-output-escaping="yes" select="metadataList/metadata[@name = 'Title']"/>
|
---|
| 260 | </a>
|
---|
| 261 | </td>
|
---|
| 262 | </tr></table>
|
---|
| 263 |
|
---|
| 264 | <!-- display any child items -->
|
---|
[19856] | 265 | <xsl:if test="documentNode">
|
---|
[23989] | 266 | <li id="toc{@nodeID}" style="display:block;">
|
---|
| 267 | <xsl:apply-templates select="documentNode" mode="TOC"/>
|
---|
| 268 | </li>
|
---|
[19856] | 269 | </xsl:if>
|
---|
[23989] | 270 |
|
---|
| 271 | </ul>
|
---|
[19856] | 272 | </xsl:template>
|
---|
[23813] | 273 |
|
---|
[23989] | 274 | <!-- Used to produce a version of the page in a format that can be read by the realistic books plugin -->
|
---|
| 275 | <xsl:template match="documentNode" mode="flashxml">
|
---|
| 276 | <xsl:text disable-output-escaping="yes">
|
---|
| 277 | <Section>
|
---|
| 278 | <Description>
|
---|
| 279 | <Metadata name="Title">
|
---|
| 280 | </xsl:text>
|
---|
| 281 | <xsl:value-of select="normalize-space(metadataList/metadata[@name = 'Title'])"/>
|
---|
| 282 | <xsl:text disable-output-escaping="yes">
|
---|
| 283 | </Metadata>
|
---|
| 284 | </Description>
|
---|
| 285 | </xsl:text>
|
---|
| 286 |
|
---|
| 287 | <xsl:value-of select="normalize-space(nodeContent)" disable-output-escaping="yes"/>
|
---|
| 288 |
|
---|
| 289 | <xsl:if test="documentNode">
|
---|
| 290 | <xsl:apply-templates select="documentNode" mode="flashxml"/>
|
---|
| 291 | </xsl:if>
|
---|
| 292 |
|
---|
| 293 | <xsl:text disable-output-escaping="yes">
|
---|
| 294 | </Section>
|
---|
| 295 | </xsl:text>
|
---|
| 296 | </xsl:template>
|
---|
| 297 |
|
---|
[23813] | 298 | <xsl:template name="externalPage">
|
---|
| 299 | <xsl:param name="external"/>
|
---|
| 300 | <xsl:variable name="go_forward_link">
|
---|
| 301 | <a>
|
---|
| 302 | <xsl:attribute name="href">
|
---|
| 303 | <xsl:value-of select="$external"/>
|
---|
| 304 | </xsl:attribute>
|
---|
| 305 | <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'external.go_forward')"/>
|
---|
| 306 | </a>
|
---|
| 307 | </xsl:variable>
|
---|
| 308 | <h2><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'external.title')"/></h2>
|
---|
| 309 | <p><xsl:value-of select="util:getInterfaceTextWithDOM($interface_name, /page/@lang, 'external.text', $go_forward_link)" disable-output-escaping="yes"/></p>
|
---|
| 310 | </xsl:template>
|
---|
[19856] | 311 |
|
---|
| 312 | <xsl:template match="/page"><xsl:apply-templates select="/page/pageResponse/document"/></xsl:template> <!-- this to be deleted eventually -->
|
---|
[23989] | 313 |
|
---|
| 314 | <xsl:template name="viewOptions">
|
---|
| 315 | <table class="viewOptions"><tr>
|
---|
[24009] | 316 | <!-- Realistic books link -->
|
---|
| 317 | <xsl:if test="/page/pageResponse/collection[@name = $collName]/metadataList/metadata[@name = 'tidyoption'] = 'tidy'">
|
---|
[23989] | 318 | <td>
|
---|
[24009] | 319 | <!-- old url = {$library_name}?a=d&c={$collName}&d={/page/pageResponse/document/documentNode[1]/@nodeID}&dt={/page/pageResponse/document/documentNode/@docType}&p.a=b&p.s={/page/pageResponse/service/@name}&book=on&ed=1 -->
|
---|
[24018] | 320 | <img>
|
---|
| 321 | <xsl:attribute name="src"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'realistic_books_image')"/></xsl:attribute>
|
---|
| 322 | </img>
|
---|
| 323 | <input id="rbOption" type="checkbox" onclick="bookInit();" class="optionCheckBox"/>
|
---|
[23989] | 324 | </td>
|
---|
| 325 | </xsl:if>
|
---|
| 326 |
|
---|
[24009] | 327 | <!-- Highlight on/off button -->
|
---|
| 328 | <xsl:if test="/page/pageRequest/paramList/param[@name = 'p.a']/@value = 'q'">
|
---|
[23989] | 329 | <td>
|
---|
[24018] | 330 | <img>
|
---|
| 331 | <xsl:attribute name="src"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'highlight_image')"/></xsl:attribute>
|
---|
| 332 | </img>
|
---|
| 333 | <input id="highlightOption" type="checkbox" class="optionCheckBox">
|
---|
| 334 | <xsl:choose>
|
---|
| 335 | <xsl:when test="/page/pageRequest/paramList/param[@name = 'hl']/@value = 'on'">
|
---|
| 336 | <xsl:attribute name="onclick">
|
---|
| 337 | <xsl:text>removeHighlight();</xsl:text>
|
---|
| 338 | </xsl:attribute>
|
---|
| 339 | <xsl:attribute name="checked">true</xsl:attribute>
|
---|
| 340 | </xsl:when>
|
---|
| 341 | <xsl:otherwise>
|
---|
| 342 | <xsl:attribute name="onclick">
|
---|
| 343 | <xsl:text>addHighlight();</xsl:text>
|
---|
| 344 | </xsl:attribute>
|
---|
| 345 | </xsl:otherwise>
|
---|
| 346 | </xsl:choose>
|
---|
| 347 | </input>
|
---|
[23989] | 348 | </td>
|
---|
| 349 | </xsl:if>
|
---|
| 350 | </tr></table>
|
---|
| 351 | </xsl:template>
|
---|
[19856] | 352 | </xsl:stylesheet>
|
---|
| 353 |
|
---|