- Timestamp:
- 2011-05-04T17:13:29+12:00 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/trunk/greenstone3/web/interfaces/oran/transform/pages/document.xsl
r23813 r23989 9 9 exclude-result-prefixes="java util gsf"> 10 10 11 <!-- use the 'main' layout --> 12 <xsl:import href="layouts/main.xsl"/> 13 11 14 <!-- style includes global params interface_name, library_name --> 12 15 <xsl:include href=".old/berrytools.xsl"/> 13 14 <!-- use the 'main' layout --> 15 <xsl:include href="layouts/main.xsl"/> 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> 16 26 17 27 <!-- set page title --> … … 32 42 </a> 33 43 </xsl:template> 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> 34 61 35 62 <!-- the page content --> 36 63 <xsl:template match="/page/pageResponse/document"> 37 38 <!-- show the little berries for this document --> 39 <xsl:call-template name="documentBerryForDocumentPage"/> 40 41 <!-- the sidebar --> 42 <div id="rightSidebar"> 43 44 <!-- show the berry basket if it's turned on --> 45 <gslib:berryBasket/> 46 47 <!-- the book's cover image --> 48 <div id="coverImage"><gslib:coverImage/></div> 49 <br/> 50 51 <!-- the contents --> 52 <ul id="tableOfContents"> 53 <xsl:apply-templates select="documentNode/documentNode"/> 54 </ul> 55 56 </div> 57 64 <xsl:if test="$bookswitch = 'off'"> 65 <!-- Add the Javascript that adds and removes highlighting ( *** in document-scripts.xsl *** ) --> 66 <xsl:call-template name="highlightingScript"/> 67 68 <!-- Add the Javascript that expands and collapses sections ( *** in document-scripts.xsl *** ) --> 69 <xsl:call-template name="expansionScript"/> 70 71 <!-- show the little berries for this document --> 72 <xsl:call-template name="documentBerryForDocumentPage"/> 73 74 <table id="rightSidebar"> 75 <tr><td> 76 <xsl:call-template name="viewOptions"/> 77 </td></tr> 78 <tr><td> 79 <!-- the sidebar --> 80 <div id="contentsArea"> 81 <!-- show the berry basket if it's turned on --> 82 <gslib:berryBasket/> 83 84 <!-- the book's cover image --> 85 <div id="coverImage"><gslib:coverImage/></div> 86 87 <!-- the contents --> 88 <div id="tableOfContents"> 89 <xsl:apply-templates select="documentNode" mode="TOC"/> 90 </div> 91 </div> 92 </td></tr> 93 </table> 94 </xsl:if> 95 58 96 <!-- display the document --> 59 97 <xsl:choose> … … 63 101 </xsl:call-template> 64 102 </xsl:when> 65 103 <xsl:when test="$bookswitch = 'flashxml'"> 104 <xsl:apply-templates mode="flashxml"/> 105 </xsl:when> 106 <xsl:when test="$bookswitch = 'on'"> 107 <!-- *** in document-scripts.xsl *** --> 108 <xsl:call-template name="realisticBooksScript"/> 109 </xsl:when> 66 110 <xsl:otherwise> 67 <!-- document heading --> 68 <xsl:variable name="doCoverImage" select="/page/pageResponse/format/gsf:option[@name='coverImages']/@value"/> 69 <xsl:variable name="doTOC" select="/page/pageResponse/format/gsf:option[@name='documentTOC']/@value"/> 70 <xsl:variable name="p.a" select="/page/pageRequest/paramList/param[@name='p.a']/@value"/> 71 <xsl:variable name="p.sa" select="/page/pageRequest/paramList/param[@name='p.sa']/@value"/> 72 <xsl:variable name="p.s" select="/page/pageRequest/paramList/param[@name='p.s']/@value"/> 73 <xsl:variable name="p.c"><xsl:choose><xsl:when test="/page/pageRequest/paramList/param[@name='p.c']"><xsl:value-of select="/page/pageRequest/paramList/param[@name='p.c']/@value"/></xsl:when><xsl:otherwise><xsl:value-of select="$collName"/></xsl:otherwise></xsl:choose></xsl:variable> 74 75 <!-- 76 <div id="documentheading"> 77 78 <!- -<a href="{$library_name}?a={$p.a}&sa={$p.sa}&s={$p.s}&c={$p.c}&rt=rd"><xsl:call-template name="openbookimg"><xsl:with-param name="title"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'close_book')"/></xsl:with-param></xsl:call-template></a>- -> 79 111 <div id="gs-document-text" class="documenttext"> 112 <xsl:apply-templates select="documentNode" mode="document"/> 113 </div> 114 </xsl:otherwise> 115 </xsl:choose> 116 117 <div class="clear"><xsl:text> </xsl:text></div> 118 </xsl:template> 119 120 <!-- Highlight annotations if requested --> 121 <xsl:template match="annotation"> 122 <xsl:choose> 123 <xsl:when test="/page/pageRequest/paramList/param[@name='hl' and @value='on']"> 124 <span class="termHighlight"><xsl:value-of select="."/></span> 125 </xsl:when> 126 <xsl:otherwise> 127 <span class="noTermHighlight"><xsl:value-of select="."/></span> 128 </xsl:otherwise> 129 </xsl:choose> 130 </xsl:template> 131 132 <!-- This template is used to display the document content --> 133 <xsl:template match="documentNode" mode="document"> 134 <a name="{@nodeID}"><xsl:text> </xsl:text></a> 135 <!-- Section header --> 136 <table><tr> 137 <!-- Expand/collapse button --> 138 <td class="headerTD"> 139 <div id="dtoggle{@nodeID}" onclick="toggleSection('{@nodeID}');"> 140 <xsl:attribute name="class"> 80 141 <xsl:choose> 81 <xsl:when test=" @docType='simple'"><xsl:value-of select="metadataList/metadata[@name='Title']" disable-output-escaping="yes"/></xsl:when>82 <xsl:otherwise> <xsl:value-of select="documentNode/metadataList/metadata[@name='Title']" disable-output-escaping="yes"/></xsl:otherwise>142 <xsl:when test="nodeContent and not(documentNode)">icon leafNode toggleImageCollapse</xsl:when> 143 <xsl:otherwise>icon toggleImageCollapse</xsl:otherwise> 83 144 </xsl:choose> 84 145 </xsl:attribute> 85 146 </div> 86 --> 87 88 <div id="gs-document-text" class="documenttext"> 89 <xsl:for-each select="descendant-or-self::node()/nodeContent"> 90 <h3><xsl:value-of disable-output-escaping="yes" select="../metadataList/metadata[@name='Title']"/></h3> 91 <xsl:for-each select="node()"> 147 </td> 148 149 <!-- Automatic section number --> 150 <td class="headerTD"> 151 <p> 152 <xsl:attribute name="class"><xsl:value-of select="util:hashToDepthClass(@nodeID)"/> sectionHeader</xsl:attribute> 153 154 <xsl:if test="util:hashToSectionId(@nodeID)"> 155 <span class="sectionNumberSpan"> 156 <xsl:value-of select="util:hashToSectionId(@nodeID)"/> 157 <xsl:text> </xsl:text> 158 </span> 159 </xsl:if> 160 <xsl:value-of disable-output-escaping="yes" select="metadataList/metadata[@name = 'Title']"/> 161 </p> 162 </td> 163 164 <!-- "back to top" link --> 165 <xsl:if test="util:hashToDepthClass(@nodeID) != 'sectionHeaderDepthTitle'"> 166 <td class="backToTop headerTD"> 167 <a href="#top"> 168 <xsl:text disable-output-escaping="yes">▲back to top</xsl:text> 169 </a> 170 </td> 171 </xsl:if> 172 </tr></table> 173 174 <!-- Section text --> 175 <div id="doc{@nodeID}" class="sectionContainer" style="display:block;"> 176 <xsl:for-each select="nodeContent"> 177 <xsl:for-each select="node()"> 178 <xsl:choose> 179 <xsl:when test="not(name())"> 180 <xsl:value-of select="." disable-output-escaping="yes"/> 181 </xsl:when> 182 <xsl:otherwise> 183 <xsl:apply-templates select="."/> 184 </xsl:otherwise> 185 </xsl:choose> 186 </xsl:for-each> 187 </xsl:for-each> 188 <xsl:if test="documentNode"> 189 <xsl:apply-templates select="documentNode" mode="document"/> 190 </xsl:if> 191 </div> 192 193 </xsl:template> 194 195 <!-- This template is used to display the table of contents --> 196 <xsl:template match="documentNode" mode="TOC"> 197 198 <!-- check if this is the currently selected table of contents item --> 199 <xsl:variable name="isCurrent" select="nodeContent"/> 200 201 <!-- formulate the link --> 202 <xsl:variable name="contentsLink"> 203 <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 204 </xsl:variable> 205 206 <ul> 207 <table><tr> 208 <!-- The expand/collapse button (not displayed for the top level node) --> 209 <xsl:if test="util:hashToDepthClass(@nodeID) != 'sectionHeaderDepthTitle'"> 210 <td> 211 <xsl:choose> 212 <xsl:when test="not(nodeContent and not(documentNode))"> 213 <div id="ttoggle{@nodeID}" onclick="toggleSection('{@nodeID}');" class="icon toggleImageCollapse"/> 214 </xsl:when> 215 <xsl:otherwise> 216 <div class="icon"/> 217 </xsl:otherwise> 218 </xsl:choose> 219 </td> 220 </xsl:if> 221 222 <!-- The chapter/page icon --> 223 <td> 224 <div> 225 <xsl:attribute name="class"> 92 226 <xsl:choose> 93 <xsl:when test="no t(name())">94 <xsl:value-of select="." disable-output-escaping="yes"/>227 <xsl:when test="nodeContent and not(documentNode)"> 228 icon leafNode toggleImagePage 95 229 </xsl:when> 96 230 <xsl:otherwise> 97 <xsl:apply-templates select="."/>231 icon toggleImageChapter 98 232 </xsl:otherwise> 99 233 </xsl:choose> 100 </xsl:for-each> 101 </xsl:for-each> 102 </div> 103 104 <gslib:previousNextButtons/> 105 106 </xsl:otherwise> 107 </xsl:choose> 108 109 <div class="clear"><xsl:text> </xsl:text></div> 110 111 </xsl:template> 112 113 <xsl:template match="documentNode"> 114 115 <!-- check if this is the currently selected table of contents item --> 116 <xsl:variable name="isCurrent" select="nodeContent"/> 117 118 <!-- formulate the link --> 119 <xsl:variable name="contentsLink"> 120 <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<!--&<xsl:if test="string($ec) = '1'">ec=1&</xsl:if> 121 p.a=<xsl:value-of select="$p.a"/>& 122 p.sa=<xsl:value-of select="$p.sa"/>& 123 p.s=<xsl:value-of select="$p.s"/>& 124 p.c=<xsl:value-of select="$p.c"/>--> 125 </xsl:variable> 126 127 <li> 128 <!-- display this item from the table of contents --> 129 <xsl:if test="$isCurrent"><xsl:attribute name="class">current</xsl:attribute></xsl:if> 130 <a> 131 <xsl:attribute name="href"><xsl:value-of select="translate( $contentsLink , ' ', '' )"/></xsl:attribute> 132 <xsl:value-of disable-output-escaping="yes" select="metadataList/metadata[@name='Title']"/> 133 </a> 134 135 <!-- display any child items --> 234 </xsl:attribute> 235 </div> 236 </td> 237 238 <!-- The section name, links to the section in the document --> 239 <td> 240 <!-- display this item from the table of contents --> 241 <xsl:if test="$isCurrent"><xsl:attribute name="class">current</xsl:attribute></xsl:if> 242 <a> 243 <xsl:attribute name="href">#<xsl:value-of select="@nodeID"/></xsl:attribute> 244 <xsl:if test="util:hashToSectionId(@nodeID)"> 245 <xsl:value-of select="util:hashToSectionId(@nodeID)"/> 246 <xsl:text> </xsl:text> 247 </xsl:if> 248 <xsl:value-of disable-output-escaping="yes" select="metadataList/metadata[@name = 'Title']"/> 249 </a> 250 </td> 251 </tr></table> 252 253 <!-- display any child items --> 136 254 <xsl:if test="documentNode"> 137 <ul> 138 <xsl:apply-templates select="documentNode"/> 139 </ul> 140 </xsl:if> 141 142 </li> 143 255 <li id="toc{@nodeID}" style="display:block;"> 256 <xsl:apply-templates select="documentNode" mode="TOC"/> 257 </li> 258 </xsl:if> 259 260 </ul> 261 </xsl:template> 262 263 <!-- Used to produce a version of the page in a format that can be read by the realistic books plugin --> 264 <xsl:template match="documentNode" mode="flashxml"> 265 <xsl:text disable-output-escaping="yes"> 266 <Section> 267 <Description> 268 <Metadata name="Title"> 269 </xsl:text> 270 <xsl:value-of select="normalize-space(metadataList/metadata[@name = 'Title'])"/> 271 <xsl:text disable-output-escaping="yes"> 272 </Metadata> 273 </Description> 274 </xsl:text> 275 276 <xsl:value-of select="normalize-space(nodeContent)" disable-output-escaping="yes"/> 277 278 <xsl:if test="documentNode"> 279 <xsl:apply-templates select="documentNode" mode="flashxml"/> 280 </xsl:if> 281 282 <xsl:text disable-output-escaping="yes"> 283 </Section> 284 </xsl:text> 144 285 </xsl:template> 145 286 … … 159 300 160 301 <xsl:template match="/page"><xsl:apply-templates select="/page/pageResponse/document"/></xsl:template> <!-- this to be deleted eventually --> 161 302 303 <xsl:template name="viewOptions"> 304 <table class="viewOptions"><tr> 305 <!-- Highlight on/off button --> 306 <xsl:if test="/page/pageRequest/paramList/param[@name = 'p.a']/@value = 'q'"> 307 <td> 308 <a id="highlightOption"> 309 <xsl:choose> 310 <xsl:when test="/page/pageRequest/paramList/param[@name = 'hl']/@value = 'on'"> 311 <xsl:attribute name="href"> 312 <xsl:text>javascript:removeHighlight();</xsl:text> 313 </xsl:attribute> 314 <xsl:text>No Highlighting</xsl:text> 315 </xsl:when> 316 <xsl:otherwise> 317 <xsl:attribute name="href"> 318 <xsl:text>javascript:addHighlight();</xsl:text> 319 </xsl:attribute> 320 <xsl:text>Highlighting</xsl:text> 321 </xsl:otherwise> 322 </xsl:choose> 323 </a> 324 </td> 325 </xsl:if> 326 327 <!-- Realistic books link --> 328 <xsl:if test="/page/pageResponse/collection[@name = $collName]/metadataList/metadata[@name = 'tidyoption'] = 'tidy'"> 329 <td> 330 <a title="Realistic book view" href="{$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"> 331 <img src="interfaces/oran/images/rbook.png"/> 332 </a> 333 </td> 334 </xsl:if> 335 </tr></table> 336 </xsl:template> 162 337 </xsl:stylesheet> 163 338
Note:
See TracChangeset
for help on using the changeset viewer.