[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 -->
|
---|
[24243] | 92 | <xsl:choose>
|
---|
| 93 | <xsl:when test="/page/pageResponse/format[@type='display']/gsf:option[@name='coverImage']/@value='true'">
|
---|
| 94 | <div id="coverImage" class="visible"><gslib:coverImage/></div>
|
---|
| 95 | </xsl:when>
|
---|
| 96 | <xsl:otherwise>
|
---|
| 97 | <div id="coverImage" class="hidden"><gslib:coverImage/></div>
|
---|
| 98 | </xsl:otherwise>
|
---|
| 99 | </xsl:choose>
|
---|
[19856] | 100 |
|
---|
[24202] | 101 | <!-- the contents (if enabled) -->
|
---|
[24243] | 102 | <xsl:choose>
|
---|
| 103 | <xsl:when test="/page/pageResponse/format[@type='display']/gsf:option[@name='TOC']/@value='true'">
|
---|
| 104 | <div id="tableOfContents" class="visible">
|
---|
| 105 | <xsl:apply-templates select="documentNode" mode="TOC"/>
|
---|
| 106 | </div>
|
---|
| 107 | </xsl:when>
|
---|
| 108 | <xsl:otherwise>
|
---|
| 109 | <div id="tableOfContents" class="hidden">
|
---|
| 110 | <xsl:apply-templates select="documentNode" mode="TOC"/>
|
---|
| 111 | </div>
|
---|
| 112 | </xsl:otherwise>
|
---|
| 113 | </xsl:choose>
|
---|
[23989] | 114 | </div>
|
---|
| 115 | </td></tr>
|
---|
| 116 | </table>
|
---|
| 117 | </xsl:if>
|
---|
| 118 |
|
---|
[19856] | 119 | <!-- display the document -->
|
---|
[23813] | 120 | <xsl:choose>
|
---|
[19856] | 121 | <xsl:when test="@external != ''">
|
---|
| 122 | <xsl:call-template name="externalPage">
|
---|
| 123 | <xsl:with-param name="external" select="@external"/>
|
---|
| 124 | </xsl:call-template>
|
---|
| 125 | </xsl:when>
|
---|
[23989] | 126 | <xsl:when test="$bookswitch = 'flashxml'">
|
---|
| 127 | <xsl:apply-templates mode="flashxml"/>
|
---|
| 128 | </xsl:when>
|
---|
| 129 | <xsl:when test="$bookswitch = 'on'">
|
---|
| 130 | <!-- *** in document-scripts.xsl *** -->
|
---|
[24018] | 131 | <div id="bookdiv" style="display:inline;"><xsl:text> </xsl:text></div>
|
---|
[23989] | 132 | <xsl:call-template name="realisticBooksScript"/>
|
---|
| 133 | </xsl:when>
|
---|
[19856] | 134 | <xsl:otherwise>
|
---|
[22785] | 135 | <div id="gs-document-text" class="documenttext">
|
---|
[23989] | 136 | <xsl:apply-templates select="documentNode" mode="document"/>
|
---|
[24009] | 137 | </div>
|
---|
[19856] | 138 | </xsl:otherwise>
|
---|
| 139 | </xsl:choose>
|
---|
| 140 |
|
---|
| 141 | <div class="clear"><xsl:text> </xsl:text></div>
|
---|
[23989] | 142 | </xsl:template>
|
---|
| 143 |
|
---|
| 144 | <!-- Highlight annotations if requested -->
|
---|
| 145 | <xsl:template match="annotation">
|
---|
| 146 | <xsl:choose>
|
---|
| 147 | <xsl:when test="/page/pageRequest/paramList/param[@name='hl' and @value='on']">
|
---|
| 148 | <span class="termHighlight"><xsl:value-of select="."/></span>
|
---|
| 149 | </xsl:when>
|
---|
| 150 | <xsl:otherwise>
|
---|
| 151 | <span class="noTermHighlight"><xsl:value-of select="."/></span>
|
---|
| 152 | </xsl:otherwise>
|
---|
| 153 | </xsl:choose>
|
---|
| 154 | </xsl:template>
|
---|
| 155 |
|
---|
| 156 | <!-- This template is used to display the document content -->
|
---|
| 157 | <xsl:template match="documentNode" mode="document">
|
---|
| 158 | <a name="{@nodeID}"><xsl:text> </xsl:text></a>
|
---|
| 159 | <!-- Section header -->
|
---|
[24202] | 160 | <table class="sectionHeader"><tr>
|
---|
[23989] | 161 | <!-- Expand/collapse button -->
|
---|
| 162 | <td class="headerTD">
|
---|
[24009] | 163 | <img id="dtoggle{@nodeID}" onclick="toggleSection('{@nodeID}');" class="icon">
|
---|
| 164 | <xsl:attribute name="src">
|
---|
| 165 | <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'collapse_image')"/>
|
---|
[23989] | 166 | </xsl:attribute>
|
---|
[24009] | 167 | </img>
|
---|
[23989] | 168 | </td>
|
---|
| 169 |
|
---|
| 170 | <!-- Automatic section number -->
|
---|
| 171 | <td class="headerTD">
|
---|
| 172 | <p>
|
---|
| 173 | <xsl:attribute name="class"><xsl:value-of select="util:hashToDepthClass(@nodeID)"/> sectionHeader</xsl:attribute>
|
---|
| 174 |
|
---|
| 175 | <xsl:if test="util:hashToSectionId(@nodeID)">
|
---|
| 176 | <span class="sectionNumberSpan">
|
---|
| 177 | <xsl:value-of select="util:hashToSectionId(@nodeID)"/>
|
---|
| 178 | <xsl:text> </xsl:text>
|
---|
| 179 | </span>
|
---|
| 180 | </xsl:if>
|
---|
[24202] | 181 | <!-- Display the title for the section regardless of whether automatic section numbering is turned on -->
|
---|
| 182 | <span class="sectionTitle"><xsl:value-of disable-output-escaping="yes" select="metadataList/metadata[@name = 'Title']"/></span>
|
---|
[23989] | 183 | </p>
|
---|
| 184 | </td>
|
---|
| 185 |
|
---|
| 186 | <!-- "back to top" link -->
|
---|
| 187 | <xsl:if test="util:hashToDepthClass(@nodeID) != 'sectionHeaderDepthTitle'">
|
---|
| 188 | <td class="backToTop headerTD">
|
---|
| 189 | <a href="#top">
|
---|
[24009] | 190 | <xsl:text disable-output-escaping="yes">▲</xsl:text><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'doc.back_to_top')"/>
|
---|
[23989] | 191 | </a>
|
---|
| 192 | </td>
|
---|
| 193 | </xsl:if>
|
---|
| 194 | </tr></table>
|
---|
| 195 |
|
---|
| 196 | <!-- Section text -->
|
---|
| 197 | <div id="doc{@nodeID}" class="sectionContainer" style="display:block;">
|
---|
| 198 | <xsl:for-each select="nodeContent">
|
---|
| 199 | <xsl:for-each select="node()">
|
---|
| 200 | <xsl:choose>
|
---|
| 201 | <xsl:when test="not(name())">
|
---|
| 202 | <xsl:value-of select="." disable-output-escaping="yes"/>
|
---|
| 203 | </xsl:when>
|
---|
| 204 | <xsl:otherwise>
|
---|
| 205 | <xsl:apply-templates select="."/>
|
---|
| 206 | </xsl:otherwise>
|
---|
| 207 | </xsl:choose>
|
---|
| 208 | </xsl:for-each>
|
---|
| 209 | </xsl:for-each>
|
---|
| 210 | <xsl:if test="documentNode">
|
---|
| 211 | <xsl:apply-templates select="documentNode" mode="document"/>
|
---|
| 212 | </xsl:if>
|
---|
| 213 | </div>
|
---|
[19856] | 214 |
|
---|
| 215 | </xsl:template>
|
---|
| 216 |
|
---|
[23989] | 217 | <!-- This template is used to display the table of contents -->
|
---|
| 218 | <xsl:template match="documentNode" mode="TOC">
|
---|
[19856] | 219 |
|
---|
| 220 | <!-- check if this is the currently selected table of contents item -->
|
---|
| 221 | <xsl:variable name="isCurrent" select="nodeContent"/>
|
---|
| 222 |
|
---|
| 223 | <!-- formulate the link -->
|
---|
| 224 | <xsl:variable name="contentsLink">
|
---|
[23989] | 225 | <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] | 226 | </xsl:variable>
|
---|
| 227 |
|
---|
[23989] | 228 | <ul>
|
---|
| 229 | <table><tr>
|
---|
| 230 | <!-- The expand/collapse button (not displayed for the top level node) -->
|
---|
| 231 | <xsl:if test="util:hashToDepthClass(@nodeID) != 'sectionHeaderDepthTitle'">
|
---|
| 232 | <td>
|
---|
| 233 | <xsl:choose>
|
---|
| 234 | <xsl:when test="not(nodeContent and not(documentNode))">
|
---|
[24009] | 235 | <img id="ttoggle{@nodeID}" onclick="toggleSection('{@nodeID}');" class="icon">
|
---|
| 236 | <xsl:attribute name="src">
|
---|
| 237 | <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'collapse_image')"/>
|
---|
| 238 | </xsl:attribute>
|
---|
| 239 | </img>
|
---|
[23989] | 240 | </xsl:when>
|
---|
| 241 | <xsl:otherwise>
|
---|
[24009] | 242 | <xsl:attribute name="class">emptyIcon</xsl:attribute>
|
---|
[23989] | 243 | </xsl:otherwise>
|
---|
| 244 | </xsl:choose>
|
---|
| 245 | </td>
|
---|
| 246 | </xsl:if>
|
---|
| 247 |
|
---|
| 248 | <!-- The chapter/page icon -->
|
---|
| 249 | <td>
|
---|
[24009] | 250 | <img>
|
---|
| 251 | <xsl:if test="nodeContent and not(documentNode)">
|
---|
| 252 | <xsl:attribute name="class">leafNode</xsl:attribute>
|
---|
| 253 | </xsl:if>
|
---|
| 254 |
|
---|
| 255 | <xsl:attribute name="src">
|
---|
[23989] | 256 | <xsl:choose>
|
---|
| 257 | <xsl:when test="nodeContent and not(documentNode)">
|
---|
[24009] | 258 | <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'page_image')"/>
|
---|
[23989] | 259 | </xsl:when>
|
---|
| 260 | <xsl:otherwise>
|
---|
[24009] | 261 | <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'chapter_image')"/>
|
---|
[23989] | 262 | </xsl:otherwise>
|
---|
| 263 | </xsl:choose>
|
---|
| 264 | </xsl:attribute>
|
---|
[24009] | 265 | </img>
|
---|
[23989] | 266 | </td>
|
---|
| 267 |
|
---|
| 268 | <!-- The section name, links to the section in the document -->
|
---|
| 269 | <td>
|
---|
| 270 | <a>
|
---|
| 271 | <xsl:attribute name="href">#<xsl:value-of select="@nodeID"/></xsl:attribute>
|
---|
| 272 | <xsl:if test="util:hashToSectionId(@nodeID)">
|
---|
| 273 | <xsl:value-of select="util:hashToSectionId(@nodeID)"/>
|
---|
| 274 | <xsl:text> </xsl:text>
|
---|
| 275 | </xsl:if>
|
---|
| 276 | <xsl:value-of disable-output-escaping="yes" select="metadataList/metadata[@name = 'Title']"/>
|
---|
| 277 | </a>
|
---|
| 278 | </td>
|
---|
| 279 | </tr></table>
|
---|
| 280 |
|
---|
| 281 | <!-- display any child items -->
|
---|
[19856] | 282 | <xsl:if test="documentNode">
|
---|
[23989] | 283 | <li id="toc{@nodeID}" style="display:block;">
|
---|
| 284 | <xsl:apply-templates select="documentNode" mode="TOC"/>
|
---|
| 285 | </li>
|
---|
[19856] | 286 | </xsl:if>
|
---|
[23989] | 287 |
|
---|
| 288 | </ul>
|
---|
[19856] | 289 | </xsl:template>
|
---|
[23813] | 290 |
|
---|
[23989] | 291 | <!-- Used to produce a version of the page in a format that can be read by the realistic books plugin -->
|
---|
| 292 | <xsl:template match="documentNode" mode="flashxml">
|
---|
| 293 | <xsl:text disable-output-escaping="yes">
|
---|
| 294 | <Section>
|
---|
| 295 | <Description>
|
---|
| 296 | <Metadata name="Title">
|
---|
| 297 | </xsl:text>
|
---|
| 298 | <xsl:value-of select="normalize-space(metadataList/metadata[@name = 'Title'])"/>
|
---|
| 299 | <xsl:text disable-output-escaping="yes">
|
---|
| 300 | </Metadata>
|
---|
| 301 | </Description>
|
---|
| 302 | </xsl:text>
|
---|
| 303 |
|
---|
| 304 | <xsl:value-of select="normalize-space(nodeContent)" disable-output-escaping="yes"/>
|
---|
| 305 |
|
---|
| 306 | <xsl:if test="documentNode">
|
---|
| 307 | <xsl:apply-templates select="documentNode" mode="flashxml"/>
|
---|
| 308 | </xsl:if>
|
---|
| 309 |
|
---|
| 310 | <xsl:text disable-output-escaping="yes">
|
---|
| 311 | </Section>
|
---|
| 312 | </xsl:text>
|
---|
| 313 | </xsl:template>
|
---|
| 314 |
|
---|
[23813] | 315 | <xsl:template name="externalPage">
|
---|
| 316 | <xsl:param name="external"/>
|
---|
| 317 | <xsl:variable name="go_forward_link">
|
---|
| 318 | <a>
|
---|
| 319 | <xsl:attribute name="href">
|
---|
| 320 | <xsl:value-of select="$external"/>
|
---|
| 321 | </xsl:attribute>
|
---|
| 322 | <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'external.go_forward')"/>
|
---|
| 323 | </a>
|
---|
| 324 | </xsl:variable>
|
---|
| 325 | <h2><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'external.title')"/></h2>
|
---|
| 326 | <p><xsl:value-of select="util:getInterfaceTextWithDOM($interface_name, /page/@lang, 'external.text', $go_forward_link)" disable-output-escaping="yes"/></p>
|
---|
| 327 | </xsl:template>
|
---|
[19856] | 328 |
|
---|
| 329 | <xsl:template match="/page"><xsl:apply-templates select="/page/pageResponse/document"/></xsl:template> <!-- this to be deleted eventually -->
|
---|
[23989] | 330 |
|
---|
| 331 | <xsl:template name="viewOptions">
|
---|
| 332 | <table class="viewOptions"><tr>
|
---|
[24009] | 333 | <!-- Realistic books link -->
|
---|
| 334 | <xsl:if test="/page/pageResponse/collection[@name = $collName]/metadataList/metadata[@name = 'tidyoption'] = 'tidy'">
|
---|
[23989] | 335 | <td>
|
---|
[24018] | 336 | <img>
|
---|
| 337 | <xsl:attribute name="src"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'realistic_books_image')"/></xsl:attribute>
|
---|
| 338 | </img>
|
---|
| 339 | <input id="rbOption" type="checkbox" onclick="bookInit();" class="optionCheckBox"/>
|
---|
[23989] | 340 | </td>
|
---|
| 341 | </xsl:if>
|
---|
| 342 |
|
---|
[24009] | 343 | <!-- Highlight on/off button -->
|
---|
[24115] | 344 | <xsl:if test="/page/pageRequest/paramList/param[@name = 'p.a']/@value = 'q' and count(//annotation) > 0">
|
---|
[23989] | 345 | <td>
|
---|
[24018] | 346 | <img>
|
---|
| 347 | <xsl:attribute name="src"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'highlight_image')"/></xsl:attribute>
|
---|
| 348 | </img>
|
---|
| 349 | <input id="highlightOption" type="checkbox" class="optionCheckBox">
|
---|
| 350 | <xsl:choose>
|
---|
| 351 | <xsl:when test="/page/pageRequest/paramList/param[@name = 'hl']/@value = 'on'">
|
---|
| 352 | <xsl:attribute name="onclick">
|
---|
| 353 | <xsl:text>removeHighlight();</xsl:text>
|
---|
| 354 | </xsl:attribute>
|
---|
| 355 | <xsl:attribute name="checked">true</xsl:attribute>
|
---|
| 356 | </xsl:when>
|
---|
| 357 | <xsl:otherwise>
|
---|
| 358 | <xsl:attribute name="onclick">
|
---|
| 359 | <xsl:text>addHighlight();</xsl:text>
|
---|
| 360 | </xsl:attribute>
|
---|
| 361 | </xsl:otherwise>
|
---|
| 362 | </xsl:choose>
|
---|
| 363 | </input>
|
---|
[23989] | 364 | </td>
|
---|
| 365 | </xsl:if>
|
---|
| 366 | </tr></table>
|
---|
| 367 | </xsl:template>
|
---|
[19856] | 368 | </xsl:stylesheet>
|
---|
| 369 |
|
---|