1 | <?xml version="1.0" encoding="UTF-8"?>
|
---|
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 | extension-element-prefixes="java util"
|
---|
8 | exclude-result-prefixes="java util">
|
---|
9 |
|
---|
10 | <xsl:variable name="groupPath"><xsl:value-of select="/page/pageRequest/paramList/param[@name='group']/@value"/></xsl:variable>
|
---|
11 |
|
---|
12 | <!-- use the 'main' layout -->
|
---|
13 | <!--<xsl:include href="layouts/main.xsl"/>-->
|
---|
14 |
|
---|
15 | <!-- set page title -->
|
---|
16 | <xsl:template name="pageTitle"><xsl:choose><xsl:when test="$groupPath != ''"><gslib:groupName path="{$groupPath}"/></xsl:when><xsl:otherwise><gslib:siteName/></xsl:otherwise></xsl:choose></xsl:template>
|
---|
17 |
|
---|
18 | <!-- set page breadcrumbs -->
|
---|
19 | <xsl:template name="breadcrumbs">
|
---|
20 | <xsl:if test="$groupPath != ''">
|
---|
21 | <gslib:siteLink/>
|
---|
22 | <xsl:for-each select="/page/pageResponse/pathList/group">
|
---|
23 | <xsl:sort data-type="number" select="@position"/>
|
---|
24 | <gslib:rightArrow/>
|
---|
25 | <xsl:if test="position() != last()">
|
---|
26 | <!-- don't want the current group in the breadcrumbs -->
|
---|
27 | <a>
|
---|
28 | <xsl:attribute name="href"><gslib:groupHref path="{@path}"/></xsl:attribute>
|
---|
29 | <xsl:attribute name="title"><gslib:groupName path="{@path}"/></xsl:attribute>
|
---|
30 | <gslib:groupName path="{@path}"/>
|
---|
31 | </a>
|
---|
32 | </xsl:if>
|
---|
33 | </xsl:for-each>
|
---|
34 | </xsl:if>
|
---|
35 | </xsl:template>
|
---|
36 |
|
---|
37 | <!-- the page content -->
|
---|
38 | <xsl:template match="/page/pageResponse">
|
---|
39 | <div class="main-wrap">
|
---|
40 | <div id="wsite-content" class="wsite-elements wsite-not-footer">
|
---|
41 | <div class="wsite-section-wrap">
|
---|
42 | <div class="wsite-section wsite-body-section wsite-background-14" >
|
---|
43 | <div class="wsite-section-content">
|
---|
44 | <div class="container">
|
---|
45 | <div class="wsite-section-elements">
|
---|
46 | <xsl:if test="groupList/group">
|
---|
47 | <div class="paragraph" style="text-align:center;">
|
---|
48 | <div class="paragraph" style="text-align:center;">Our purpose is <strong style="color:rgb(63, 63, 63)"><em>“Kia rangatira ai ngÄ uri o te WhakatÅhea” – “To lift our nation, and to grow and invest in the well-being of our people”.</em></strong><br /><span style="color:rgb(63, 63, 63)">The WhakatÅhea MÄori Trust Board</span> exists to improve the lives of its people <br />through the six <em><strong>“50-year Strategic Goals”</strong></em> these are defined as the following <strong>Six Pou:</strong> <br /></div>
|
---|
49 | </div>
|
---|
50 | </xsl:if>
|
---|
51 | <!-- forced to add nbsp (which in XSL is  ) in div.wsite-spacer
|
---|
52 | because otherwise text overflows from the main page into footer
|
---|
53 | caused by html rendering of div.wsite-spacer's subsequent sibling
|
---|
54 | divs as *children* of div.wsite-spacer instead.
|
---|
55 | Beware that XSL errors ensue if is used as it's not a defined
|
---|
56 | entity in XSL, only in HTML. Must use   for nbsp in XSL, see
|
---|
57 | https://stackoverflow.com/questions/1461649/how-to-insert-nbsp-in-xslt
|
---|
58 | -->
|
---|
59 | <div class="wsite-spacer" style="height:50px;">
|
---|
60 |      
|
---|
61 | </div>
|
---|
62 | <div><div class="wsite-multicol"><div class="wsite-multicol-table-wrap" style="margin:0 -15px;">
|
---|
63 | <table class="wsite-multicol-table">
|
---|
64 | <tbody class="wsite-multicol-tbody">
|
---|
65 | <tr class="wsite-multicol-tr">
|
---|
66 | <!-- <xsl:call-template name="collectionAndGroupLinks"/> -->
|
---|
67 |
|
---|
68 | <!-- output the groups, the following outputs them column wise -->
|
---|
69 | <xsl:apply-templates select="groupList/group" mode="displayGroupInfo" />
|
---|
70 | <!-- then output the collectionList in a final column -->
|
---|
71 | <xsl:apply-templates select="collectionList/collection" mode="displayCollInfo" />
|
---|
72 | </tr>
|
---|
73 |
|
---|
74 | </tbody>
|
---|
75 | </table>
|
---|
76 | </div></div></div>
|
---|
77 | </div>
|
---|
78 | </div>
|
---|
79 | </div>
|
---|
80 |
|
---|
81 | </div>
|
---|
82 | </div>
|
---|
83 |
|
---|
84 | </div>
|
---|
85 | </div><!-- end class main-wrap-->
|
---|
86 | </xsl:template>
|
---|
87 |
|
---|
88 | <xsl:template name="additionalHeaderContent">
|
---|
89 | <script type="text/javascript" src="interfaces/{$interface_name}/scripts/jquery.easing.1.3.js"><xsl:text> </xsl:text></script>
|
---|
90 | <script type="text/javascript" src="interfaces/{$interface_name}/scripts/jquery.timers.1.2.js"><xsl:text> </xsl:text></script>
|
---|
91 | <script type="text/javascript" src="interfaces/{$interface_name}/scripts/jquery.galleryview.2.1.1.min.js"><xsl:text> </xsl:text></script>
|
---|
92 | <script type="text/javascript" src="interfaces/{$interface_name}/scripts/jquery.galleryview.setup.js"><xsl:text> </xsl:text></script>
|
---|
93 | </xsl:template>
|
---|
94 |
|
---|
95 | <xsl:template name="collectionsList">
|
---|
96 | <!-- for every collection in the library -->
|
---|
97 | <xsl:for-each select="./collectionList/collection">
|
---|
98 | <xsl:call-template name="collDescription"/>
|
---|
99 | </xsl:for-each>
|
---|
100 | </xsl:template>
|
---|
101 |
|
---|
102 | <!--
|
---|
103 | Template has match and name attributes allowing this to be called with both
|
---|
104 | apply-templates and call-template.
|
---|
105 | https://stackoverflow.com/questions/6478163/can-an-xslt-template-carry-both-name-and-match-attributes
|
---|
106 | -->
|
---|
107 | <xsl:template match="collection" name="collDescription" mode="displayColl">
|
---|
108 | <xsl:variable name="collectionFolder" select="@name"/>
|
---|
109 | <xsl:variable name="collectionName" select="displayItemList/displayItem[@name='name']"/>
|
---|
110 | <xsl:variable name="aboutImage" select="displayItemList/displayItem[@name='icon']"/>
|
---|
111 | <xsl:variable name="homeImage" select="displayItemList/displayItem[@name='smallicon']"/>
|
---|
112 | <xsl:variable name="collDesc" select="displayItemList/displayItem[@name='description']"/>
|
---|
113 | <xsl:variable name="numDocs" select="metadataList/metadata[@name='numDocs']"/>
|
---|
114 | <!-- creates a header that links to the collection's about page -->
|
---|
115 |
|
---|
116 | <!-- if there is an About page image for the collection, this is displayed -->
|
---|
117 | <xsl:if test="$homeImage">
|
---|
118 | <div><div class="wsite-image wsite-image-border-thin " style="padding-top:10px;padding-bottom:10px;margin-left:0;margin-right:0;text-align:center">
|
---|
119 | <img src="sites/{$site_name}/collect/{$collectionFolder}/images/{$homeImage}" alt="{$collectionName}" title="{$collectionName}" style="max-width:100%" />
|
---|
120 | </div></div>
|
---|
121 | <div style="display:block;font-size:90%"></div>
|
---|
122 | </xsl:if>
|
---|
123 |
|
---|
124 | <!-- don't centre collection description (div class=paragraph)
|
---|
125 | with style="text-align:center;
|
---|
126 | since the collection description may be HTML in its own right -->
|
---|
127 | <div class="paragraph">
|
---|
128 | <a href="{$library_name}/collection/{$collectionFolder}/page/about" title="{$collectionName}" alt="{$collectionName}"><xsl:value-of select="$collectionName"/></a>
|
---|
129 | <br />
|
---|
130 | <xsl:choose>
|
---|
131 | <!-- has a description - display it -->
|
---|
132 | <xsl:when test="$collDesc">
|
---|
133 |
|
---|
134 | <!--<xsl:value-of select="$collDesc" disable-output-escaping="yes"/>--><xsl:apply-templates select="displayItemList/displayItem[@name='description']"/>
|
---|
135 | </xsl:when>
|
---|
136 | <!-- no description - a generic sentence -->
|
---|
137 | <xsl:otherwise>
|
---|
138 | <p class="justify">Welcome to the <xsl:value-of select="$collectionName"/> collection. This collection contains <xsl:value-of select="$numDocs"/> documents.</p>
|
---|
139 | </xsl:otherwise>
|
---|
140 | </xsl:choose>
|
---|
141 | </div>
|
---|
142 | </xsl:template>
|
---|
143 |
|
---|
144 | <xsl:template name="collectionAndGroupLinks">
|
---|
145 | <xsl:for-each select="collectionList/collection|groupList/group">
|
---|
146 | <xsl:sort data-type="number" select="@position"/>
|
---|
147 | <td class="wsite-multicol-col" style="width:33.333333333333%; padding:0 15px;">
|
---|
148 | <xsl:if test="name() = 'collection'">
|
---|
149 | <xsl:call-template name="collDescription"/>
|
---|
150 | </xsl:if>
|
---|
151 | <xsl:if test="name() = 'group'">
|
---|
152 | <xsl:call-template name="customGroupDescription"/>
|
---|
153 | </xsl:if>
|
---|
154 | </td>
|
---|
155 | </xsl:for-each>
|
---|
156 | </xsl:template>
|
---|
157 |
|
---|
158 | <!-- https://stackoverflow.com/questions/93511/counter-inside-xslfor-each-loop
|
---|
159 | will not work, since we have an if-statement inside the for loop to filter for groups.
|
---|
160 | Instead, counting only the groups using Borodin's solution (still xslt 1.0) from
|
---|
161 | https://stackoverflow.com/questions/16504727/increment-counter-in-xslt-1-0 works.
|
---|
162 |
|
---|
163 | While that gives us a proper counter not dependent on position(), it doesn't solve
|
---|
164 | that we need to open a tag (td) on odd count and close it on even.
|
---|
165 | For that, the solution is at:
|
---|
166 | https://stackoverflow.com/questions/17992481/xsl-wrap-every-2-items-in-the-for-each-with-a-div
|
---|
167 |
|
---|
168 | General: https://stackoverflow.com/questions/4478045/what-are-the-differences-between-call-template-and-apply-templates-in-xsl
|
---|
169 | -->
|
---|
170 | <xsl:template match="group" mode="displayGroupInfo">
|
---|
171 | <xsl:variable name="counter"><xsl:value-of select="1+count(preceding-sibling::group)])"/></xsl:variable>
|
---|
172 | <xsl:if test="($counter mod 2) = 1">
|
---|
173 | <td class="wsite-multicol-col" style="width:33.333333333333%; padding:0 15px;">
|
---|
174 | <xsl:apply-templates select=". | following-sibling::group[1]" />
|
---|
175 | <!-- calls the template match="group" without mode this time -->
|
---|
176 | </td>
|
---|
177 | </xsl:if>
|
---|
178 | </xsl:template>
|
---|
179 |
|
---|
180 | <!-- We want collections to appear in a separate and single column.
|
---|
181 | So we don't do even odd columns here. -->
|
---|
182 | <xsl:template match="collection" mode="displayCollInfo">
|
---|
183 | <!--<xsl:variable name="counter"><xsl:value-of select="1+count(preceding-sibling::collection)])"/></xsl:variable>
|
---|
184 | <xsl:if test="($counter mod 2) = 1">-->
|
---|
185 | <td class="wsite-multicol-col" style="width:33.333333333333%; padding:0 15px;">
|
---|
186 | <!--<xsl:apply-templates select=". | following-sibling::collection[1]" />-->
|
---|
187 | <xsl:apply-templates select="." mode="displayColl"/>
|
---|
188 | <!-- why does calling the template match="collection" without some mode
|
---|
189 | attr this time NOT work? -->
|
---|
190 | </td>
|
---|
191 | <!--</xsl:if>-->
|
---|
192 | </xsl:template>
|
---|
193 |
|
---|
194 | <xsl:template match="/page/xsltparams">
|
---|
195 | <!-- suppress xsltparam block in page -->
|
---|
196 | </xsl:template>
|
---|
197 |
|
---|
198 | <!-- Modified version of <gslib:groupLinkWithImage/>-->
|
---|
199 | <!--
|
---|
200 | Template has match and name attributes allowing this to be called with both
|
---|
201 | apply-templates and call-template.
|
---|
202 | https://stackoverflow.com/questions/6478163/can-an-xslt-template-carry-both-name-and-match-attributes
|
---|
203 | -->
|
---|
204 | <xsl:template match="group" name="customGroupDescription">
|
---|
205 |
|
---|
206 | <xsl:variable name="short"><xsl:value-of select="shortDescription"/></xsl:variable>
|
---|
207 | <xsl:variable name="desc"><xsl:value-of select="description"/></xsl:variable>
|
---|
208 | <xsl:variable name="group_href"><xsl:value-of select="$library_name"/>/group/<xsl:if test="/page/pageRequest/paramList/param[@name='group']"><xsl:value-of select="/page/pageRequest/paramList/param[@name='group']/@value"/>/</xsl:if><xsl:value-of select="@name"/></xsl:variable>
|
---|
209 |
|
---|
210 |
|
---|
211 | <!-- if there is an image for this group, this is displayed -->
|
---|
212 | <xsl:if test="util:checkFileExistence($site_name, backgroundImage)">
|
---|
213 | <div><div class="wsite-image wsite-image-border-thin " style="padding-top:10px;padding-bottom:10px;margin-left:0;margin-right:0;text-align:center">
|
---|
214 | <img class="groupLinkImage">
|
---|
215 | <xsl:attribute name="alt"><xsl:value-of select="@name"/></xsl:attribute>
|
---|
216 | <xsl:attribute name="title"><xsl:value-of select="@name"/></xsl:attribute>
|
---|
217 | <xsl:attribute name="style"><xsl:text>max-width:100%</xsl:text></xsl:attribute>
|
---|
218 | <xsl:attribute name="src">sites/<xsl:value-of select="$site_name"/>/<xsl:value-of select="backgroundImage"/></xsl:attribute>
|
---|
219 | </img>
|
---|
220 | </div></div>
|
---|
221 | <div style="display:block;font-size:90%"></div>
|
---|
222 | </xsl:if>
|
---|
223 |
|
---|
224 | <!-- some text for the group -->
|
---|
225 | <div class="paragraph" style="text-align:center;">
|
---|
226 | <!-- group title links to the collection's about page -->
|
---|
227 | <a href="{$group_href}" title="{$short}" alt="{$short}">
|
---|
228 | <xsl:choose>
|
---|
229 | <xsl:when test="boolean(title)">
|
---|
230 | <xsl:value-of select="title"/>
|
---|
231 | </xsl:when>
|
---|
232 | <xsl:otherwise>
|
---|
233 | <xsl:value-of select="@name"/>
|
---|
234 | </xsl:otherwise>
|
---|
235 | </xsl:choose>
|
---|
236 | </a>
|
---|
237 | <br />
|
---|
238 | <xsl:choose>
|
---|
239 | <!-- If the group has a description - display it -->
|
---|
240 | <xsl:when test="$desc">
|
---|
241 | <xsl:value-of select="$desc" disable-output-escaping="yes"/>
|
---|
242 | </xsl:when>
|
---|
243 | <!-- If no group description - repeat group name -->
|
---|
244 | <xsl:otherwise>
|
---|
245 | Collection group: <xsl:value-of select="@name" disable-output-escaping="yes"/>
|
---|
246 | </xsl:otherwise>
|
---|
247 | </xsl:choose>
|
---|
248 | </div>
|
---|
249 |
|
---|
250 | </xsl:template>
|
---|
251 |
|
---|
252 | </xsl:stylesheet>
|
---|
253 |
|
---|
254 |
|
---|