source: trunk/gsdl3/interfaces/default/transform/classifier.xsl@ 3436

Last change on this file since 3436 was 3435, checked in by kjdon, 22 years ago

xsl for browsing old gsdl-type classifiers

  • Property svn:keywords set to Author Date Id Revision
File size: 6.6 KB
Line 
1<?xml version="1.0" encoding="ISO-8859-1"?>
2<xsl:stylesheet version="1.0"
3xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
4xmlns:java="http://xml.apache.org/xslt/java"
5extension-element-prefixes="java">
6
7<xsl:include href="style-tmp.xsl"/>
8
9<xsl:output method="html"/>
10
11<xsl:template match="page">
12<html>
13<xsl:call-template name="greenstoneHead"/>
14<body xsl:use-attribute-sets="body-style">
15<center>
16<xsl:apply-templates select="response/classifier"/>
17</center>
18<xsl:call-template name="greenstoneFooter"/>
19</body>
20</html>
21</xsl:template>
22
23<!-- recursively process all nodes and resources -->
24
25<xsl:template match="classifier[@type='vertical' and @interleave='true']">
26<xsl:variable name='link' select='@link'/>
27<xsl:value-of select="@name"/>
28<p/>
29<table width='537'><xsl:for-each select='node|resource'>
30<xsl:choose><xsl:when test='name()="node"'><tr valign='top'><xsl:apply-templates select='.' mode='current-node'><xsl:with-param name='link' select='$link'/></xsl:apply-templates><xsl:apply-templates select='.' mode='process-children'><xsl:with-param name='interleave'>true</xsl:with-param></xsl:apply-templates></tr>
31</xsl:when>
32<xsl:otherwise><tr valign='top'><xsl:apply-templates select='.'/></tr>
33</xsl:otherwise></xsl:choose>
34</xsl:for-each>
35</table>
36</xsl:template>
37
38<xsl:template match="classifier[@type='vertical' and @interleave='false']">
39<xsl:variable name='link' select='@link'/>
40<xsl:value-of select="@name"/>
41<p/>
42<!-- process the nodes and resources separately-->
43<table width='537'>
44<xsl:for-each select='node'>
45<tr valign='top'><xsl:apply-templates select='.' mode='current-node'><xsl:with-param name='link' select='$link'/></xsl:apply-templates></tr><tr><td></td><td><xsl:apply-templates select='.' mode='process-children'><xsl:with-param name='interleave' select='false'/></xsl:apply-templates></td></tr></xsl:for-each>
46</table>
47<table width='537'>
48<xsl:for-each select='//resource'>
49<tr valign='top'><xsl:apply-templates select='.'></xsl:apply-templates></tr>
50</xsl:for-each>
51</table>
52</xsl:template>
53
54<xsl:template match="classifier[@type='horizontal' and @interleave='false']">
55<xsl:variable name='link' select='@link'/>
56<xsl:value-of select="@name"/>
57<p/>
58<!-- process the nodes and resources separately-->
59
60<table width='537'><tr valign='top'>
61<xsl:for-each select='node'>
62<xsl:apply-templates select='.' mode='current-node'><xsl:with-param name='link' select='$link'/></xsl:apply-templates>
63</xsl:for-each></tr>
64<tr valign='top'>
65<xsl:for-each select='node'>
66<xsl:apply-templates select='.' mode='process-children'><xsl:with-param name='interleave' select='false'/></xsl:apply-templates></xsl:for-each></tr>
67</table>
68<table width='537'>
69<xsl:for-each select='//resource'>
70<tr valign='top'><xsl:apply-templates select='.'/></tr>
71</xsl:for-each>
72</table>
73</xsl:template>
74
75<xsl:template match="classifier[@type='horizontal' and @interleave='true']">
76<xsl:variable name='link' select='@link'/>
77<xsl:value-of select="@name"/>
78<p/>
79<!-- process the nodes and resources together -->
80
81<table><tr valign='top'>
82<xsl:for-each select='node|resource'>
83<xsl:choose><xsl:when test='name()="node"'><xsl:apply-templates select='.' mode='current-node'><xsl:with-param name='link' select='$link'/></xsl:apply-templates><xsl:apply-templates select='.' mode='process-children'><xsl:with-param name='interleave'>true</xsl:with-param></xsl:apply-templates>
84</xsl:when>
85<xsl:otherwise><xsl:apply-templates select='.'/>
86</xsl:otherwise></xsl:choose>
87</xsl:for-each>
88</tr></table>
89</xsl:template>
90
91<xsl:template match="resource">
92<xsl:variable name='library' select='ancestor::page/config/library_name'/>
93<td><a href="{$library}?a=r&amp;c=mgppdemo&amp;r={@name}">+++</a></td><td><xsl:value-of select="metadataList/metadata[@name='Title']"/></td>
94</xsl:template>
95
96
97<!-- the output for the classifier link and label, may be overwritten -->
98
99<xsl:template match="node" mode="current-node">
100<xsl:param name="link" select="icon"/>
101<xsl:variable name="library" select="ancestor::page/config/library_name"/>
102<xsl:choose><xsl:when test="$link='icon'">
103<td><a href="{$library}?a=b&amp;c=mgppdemo&amp;cl={@name}">***</a></td><td><xsl:value-of select="@name"/></td>
104</xsl:when><xsl:otherwise>
105<td><a href="{$library}?a=b&amp;c=mgppdemo&amp;cl={@name}"><xsl:value-of select="@name"/></a></td>
106</xsl:otherwise></xsl:choose>
107</xsl:template>
108
109<!-- processing for the recursive bit -->
110<!-- if interleave=true, process all child nodes and resources, else just do nodes -->
111
112<xsl:template match="node" mode="process-children">
113<xsl:param name="link" select="icon"/>
114<xsl:param name='interleave'>true</xsl:param>
115<xsl:choose><xsl:when test="$interleave='true'">
116<td><p/>
117<xsl:choose><xsl:when test='@type="vertical"'>
118<table><xsl:for-each select='node|resource'>
119<xsl:choose><xsl:when test='name()="node"'><tr valign='top'><xsl:apply-templates select='.' mode='current-node'><xsl:with-param name='link' select='$link'/></xsl:apply-templates><xsl:apply-templates select='.' mode='process-children'><xsl:with-param name='interleave'>true</xsl:with-param></xsl:apply-templates></tr>
120</xsl:when>
121<xsl:otherwise><tr valign='top'><xsl:apply-templates select='.'/></tr>
122</xsl:otherwise></xsl:choose><!-- name=node -->
123</xsl:for-each></table>
124</xsl:when>
125<xsl:otherwise><!-- type = vertical fails -->
126<table><tr valign='top'><xsl:for-each select='node|resource'>
127<xsl:choose><xsl:when test='name()="node"'><xsl:apply-templates select='.' mode='current-node'><xsl:with-param name='link' select='$link'/></xsl:apply-templates><xsl:apply-templates select='.' mode='process-children'><xsl:with-param name='interleave'>true</xsl:with-param></xsl:apply-templates>
128</xsl:when>
129<xsl:otherwise><xsl:apply-templates select='.'/>
130</xsl:otherwise></xsl:choose> <!-- name=node -->
131</xsl:for-each>
132</tr></table>
133</xsl:otherwise></xsl:choose><!-- end of orientation choice -->
134</td>
135</xsl:when>
136<xsl:otherwise> <!-- interleave = false -->
137<td><p/>
138<xsl:choose><xsl:when test='@type="vertical"'>
139<table><xsl:for-each select='node'><tr><xsl:apply-templates select='.' mode='current-node'><xsl:with-param name='link' select='$link'/></xsl:apply-templates></tr><tr><xsl:apply-templates select='.' mode='process-children'><xsl:with-param name='interleave'>false</xsl:with-param></xsl:apply-templates></tr></xsl:for-each></table>
140</xsl:when>
141<xsl:otherwise>
142<table><tr valign='top'><xsl:apply-templates select='node' mode='current-node'><xsl:with-param name='link' select='$link'/></xsl:apply-templates><xsl:apply-templates select='node' mode='process-children'><xsl:with-param name='interleave'>false</xsl:with-param></xsl:apply-templates></tr></table>
143</xsl:otherwise></xsl:choose> <!-- end of orientation choice -->
144</td>
145</xsl:otherwise>
146</xsl:choose> <!-- end of interleave choice -->
147</xsl:template>
148
149</xsl:stylesheet>
Note: See TracBrowser for help on using the repository browser.