source: greenstone3/trunk/web/interfaces/oran/transform/pages/document.xsl@ 19856

Last change on this file since 19856 was 19856, checked in by oranfry, 15 years ago

reorganising transform for new interface

File size: 5.1 KB
Line 
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
11 <!-- style includes global params interface_name, library_name -->
12 <xsl:include href=".old/berrytools.xsl"/>
13
14 <!-- make this page use the 'main' layout -->
15 <xsl:include href="layouts/main.xsl"/>
16
17 <!-- set page title and subtitle-->
18 <xsl:template name="title"><gslib:collectionName/></xsl:template>
19 <xsl:template name="linked-title"><a><xsl:attribute name="href">/<xsl:value-of select="collection/@name"/></xsl:attribute><gslib:collectionName/></a></xsl:template>
20
21 <xsl:template match="/page/pageResponse/document">
22
23 <!-- show the little berries for this document -->
24 <xsl:call-template name="documentBerryForDocumentPage"/>
25
26 <!-- the sidebar -->
27 <div id="rightSidebar">
28
29 <!-- show the berry basket if it's turned on -->
30 <gslib:berryBasket/>
31
32 <!-- the book's cover image -->
33 <div id="coverImage"><gslib:coverImage/></div>
34 <br/>
35
36 <!-- the contents -->
37 <ul id="tableOfContents">
38 <xsl:apply-templates select="documentNode/documentNode"/>
39 </ul>
40
41 </div>
42
43 <!-- display the document -->
44 <xsl:choose>
45
46 <xsl:when test="@external != ''">
47 <xsl:call-template name="externalPage">
48 <xsl:with-param name="external" select="@external"/>
49 </xsl:call-template>
50 </xsl:when>
51
52 <xsl:otherwise>
53 <!-- document heading -->
54 <xsl:variable name="doCoverImage" select="/page/pageResponse/format/gsf:option[@name='coverImages']/@value"/>
55 <xsl:variable name="doTOC" select="/page/pageResponse/format/gsf:option[@name='documentTOC']/@value"/>
56 <xsl:variable name="p.a" select="/page/pageRequest/paramList/param[@name='p.a']/@value"/>
57 <xsl:variable name="p.sa" select="/page/pageRequest/paramList/param[@name='p.sa']/@value"/>
58 <xsl:variable name="p.s" select="/page/pageRequest/paramList/param[@name='p.s']/@value"/>
59 <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>
60
61 <div id="documentheading">
62
63 <!--<a href="{$library_name}?a={$p.a}&amp;sa={$p.sa}&amp;s={$p.s}&amp;c={$p.c}&amp;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>-->
64
65 <xsl:choose>
66 <xsl:when test="@docType='simple'"><xsl:value-of select="metadataList/metadata[@name='Title']" disable-output-escaping="yes"/></xsl:when>
67 <xsl:otherwise><xsl:value-of select="documentNode/metadataList/metadata[@name='Title']" disable-output-escaping="yes"/></xsl:otherwise>
68 </xsl:choose>
69
70 </div>
71
72 <div class="documenttext">
73 <xsl:for-each select="descendant-or-self::node()/nodeContent">
74 <h3><xsl:value-of disable-output-escaping="yes" select="../metadataList/metadata[@name='Title']"/></h3>
75 <xsl:for-each select="node()">
76 <xsl:choose>
77 <xsl:when test="not(name())">
78 <xsl:value-of select="." disable-output-escaping="yes"/>
79 </xsl:when>
80 <xsl:otherwise>
81 <xsl:apply-templates select="."/>
82 </xsl:otherwise>
83 </xsl:choose>
84 </xsl:for-each>
85 </xsl:for-each>
86 </div>
87
88 <gslib:previousNextButtons/>
89
90 </xsl:otherwise>
91 </xsl:choose>
92
93 <div class="clear"><xsl:text> </xsl:text></div>
94
95 </xsl:template>
96
97 <xsl:template match="documentNode">
98
99 <!-- check if this is the currently selected table of contents item -->
100 <xsl:variable name="isCurrent" select="nodeContent"/>
101
102 <!-- formulate the link -->
103 <xsl:variable name="contentsLink">
104 <xsl:value-of select='$library_name'/>?
105 a=d&amp;
106 c=<gslib:collectionShortName/>&amp;
107 d=<xsl:value-of select='@nodeID'/><xsl:if test="documentNode">.pr</xsl:if>&amp;
108 sib=1&amp;
109 <!--<xsl:if test="string($ec) = '1'">ec=1&amp;</xsl:if>
110 p.a=<xsl:value-of select="$p.a"/>&amp;
111 p.sa=<xsl:value-of select="$p.sa"/>&amp;
112 p.s=<xsl:value-of select="$p.s"/>&amp;
113 p.c=<xsl:value-of select="$p.c"/>-->
114 </xsl:variable>
115
116 <li>
117 <!-- display this item from the table of contents -->
118 <xsl:if test="$isCurrent"><xsl:attribute name="class">current</xsl:attribute></xsl:if>
119 <a>
120 <xsl:attribute name="href"><xsl:value-of select="translate( $contentsLink , ' ', '' )"/></xsl:attribute>
121 <xsl:value-of disable-output-escaping="yes" select="metadataList/metadata[@name='Title']"/>
122 </a>
123
124 <!-- display any child items -->
125 <xsl:if test="documentNode">
126 <ul>
127 <xsl:apply-templates select="documentNode"/>
128 </ul>
129 </xsl:if>
130
131 </li>
132
133 </xsl:template>
134
135 <xsl:template match="/page"><xsl:apply-templates select="/page/pageResponse/document"/></xsl:template> <!-- this to be deleted eventually -->
136
137</xsl:stylesheet>
138
Note: See TracBrowser for help on using the repository browser.