Changeset 3456 for trunk/gsdl3
- Timestamp:
- 2002-10-11T13:40:29+13:00 (22 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gsdl3/interfaces/default/transform/classifier.xsl
r3435 r3456 5 5 extension-element-prefixes="java"> 6 6 7 <xsl:include href="style -tmp.xsl"/>7 <xsl:include href="style.xsl"/> 8 8 9 9 <xsl:output method="html"/> 10 10 11 11 <xsl:template match="page"> 12 <xsl:variable name="collName"><xsl:value-of select="request/paramList/param[@name='c']/@value"/></xsl:variable> 12 13 <html> 13 14 <xsl:call-template name="greenstoneHead"/> 14 15 <body xsl:use-attribute-sets="body-style"> 15 16 <center> 16 <xsl:apply-templates select="response/classifier"/> 17 <xsl:call-template name="collectionPageBanner"> 18 <xsl:with-param name="collName" select="$collName"/> 19 </xsl:call-template> 20 <xsl:apply-templates select="request/description/classifierList"> 21 <xsl:with-param name="collName" select="$collName"/> 22 </xsl:apply-templates> 23 <p/> 24 <xsl:apply-templates select="response/content/classifier"> 25 <xsl:with-param name="collName" select="$collName"/> 26 </xsl:apply-templates> 17 27 </center> 18 28 <xsl:call-template name="greenstoneFooter"/> … … 21 31 </xsl:template> 22 32 33 <xsl:template match="classifierList"> 34 <xsl:param name="collName">coll-name</xsl:param> 35 <xsl:variable name="library" select="ancestor::page/config/library_name"/> 36 <xsl:variable name="selected" select="ancestor::page/response/content/classifier/@name"/> 37 <table width='537'><tr> 38 <xsl:for-each select="classifier"> 39 <xsl:choose> 40 <xsl:when test="@name=$selected"> 41 <td align='center'><xsl:value-of select="metadataList/metadata[@name='Title']"/></td> 42 </xsl:when> 43 <xsl:otherwise> 44 <td align='center'><a href="{$library}?a=b&sa=classifier&c={$collName}&cl={@name}"><xsl:value-of select="metadataList/metadata[@name='Title']"/></a></td></xsl:otherwise></xsl:choose> 45 </xsl:for-each> 46 </tr></table> 47 <xsl:call-template name="greenBar"/> 48 </xsl:template> 49 23 50 <!-- recursively process all nodes and resources --> 24 51 25 52 <xsl:template match="classifier[@type='vertical' and @interleave='true']"> 26 <xsl:variable name='link' select='@link'/> 27 <xsl:value-of select="@name"/> 28 <p/> 53 <xsl:param name="collName">coll-name</xsl:param> 54 <xsl:variable name='link' select='@link'/> 29 55 <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> 56 <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:with-param name='collName' select='$collName'/></xsl:apply-templates></tr><tr valign='top'><td></td><xsl:apply-templates select='.' mode='process-all-children'><xsl:with-param name='collName' select='$collName'/><xsl:with-param name='link' select='$link'/></xsl:apply-templates></tr> 57 </xsl:when> 58 <xsl:otherwise><tr valign='top'><xsl:apply-templates select='.'><xsl:with-param name='collName' select='$collName'/></xsl:apply-templates></tr> 59 </xsl:otherwise></xsl:choose> 60 </xsl:for-each> 61 </table> 62 <xsl:call-template name="greenBar"/> 36 63 </xsl:template> 37 64 38 65 <xsl:template match="classifier[@type='vertical' and @interleave='false']"> 39 <xsl:variable name='link' select='@link'/> 40 <xsl:value-of select="@name"/> 41 <p/> 66 <xsl:param name="collName">coll-name</xsl:param> 67 <xsl:variable name='link' select='@link'/> 42 68 <!-- process the nodes and resources separately--> 43 69 <table width='537'> 44 70 <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>71 <tr valign='top'><xsl:apply-templates select='.' mode='current-node'><xsl:with-param name='link' select='$link'/><xsl:with-param name='collName' select='$collName'/></xsl:apply-templates></tr><tr valign='top'><td></td><xsl:apply-templates select='.' mode='process-node-children'><xsl:with-param name='collName' select='$collName'/><xsl:with-param name='link' select='$link'/></xsl:apply-templates></tr></xsl:for-each> 46 72 </table> 47 73 <table width='537'> 48 74 <xsl:for-each select='//resource'> 49 <tr valign='top'><xsl:apply-templates select='.'></xsl:apply-templates></tr> 50 </xsl:for-each> 51 </table> 75 <tr valign='top'><xsl:apply-templates select='.'><xsl:with-param name='collName' select='$collName'/></xsl:apply-templates></tr> 76 </xsl:for-each> 77 </table> 78 <xsl:call-template name="greenBar"/> 52 79 </xsl:template> 53 80 54 81 <xsl:template match="classifier[@type='horizontal' and @interleave='false']"> 55 <xsl:variable name='link' select='@link'/> 56 <xsl:value-of select="@name"/> 57 <p/> 82 <xsl:param name="collName">coll-name</xsl:param> 83 <xsl:variable name='link' select='@link'/> 58 84 <!-- process the nodes and resources separately--> 59 85 60 86 <table width='537'><tr valign='top'> 61 87 <xsl:for-each select='node'> 62 <xsl:apply-templates select='.' mode='current-node'><xsl:with-param name='link' select='$link'/>< /xsl:apply-templates>88 <xsl:apply-templates select='.' mode='current-node'><xsl:with-param name='link' select='$link'/><xsl:with-param name='collName' select='$collName'/></xsl:apply-templates> 63 89 </xsl:for-each></tr> 64 90 <tr valign='top'> 65 91 <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>92 <xsl:apply-templates select='.' mode='process-node-children'><xsl:with-param name='collName' select='$collName'/><xsl:with-param name='link' select='$link'/></xsl:apply-templates></xsl:for-each></tr> 67 93 </table> 68 94 <table width='537'> 69 95 <xsl:for-each select='//resource'> 70 <tr valign='top'><xsl:apply-templates select='.'/></tr> 71 </xsl:for-each> 72 </table> 96 <tr valign='top'><xsl:apply-templates select='.'><xsl:with-param name='collName' select='$collName'/></xsl:apply-templates></tr> 97 </xsl:for-each> 98 </table> 99 <xsl:call-template name="greenBar"/> 73 100 </xsl:template> 74 101 75 102 <xsl:template match="classifier[@type='horizontal' and @interleave='true']"> 76 <xsl:variable name='link' select='@link'/> 77 <xsl:value-of select="@name"/> 78 <p/> 103 <xsl:param name="collName">coll-name</xsl:param> 104 <xsl:variable name='link' select='@link'/> 79 105 <!-- process the nodes and resources together --> 80 106 81 107 <table><tr valign='top'> 82 108 <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> 109 <xsl:choose><xsl:when test='name()="node"'><xsl:apply-templates select='.' mode='current-node'><xsl:with-param name='link' select='$link'/><xsl:with-param name='collName' select='$collName'/></xsl:apply-templates> 110 </xsl:when> 111 <xsl:otherwise><xsl:apply-templates select='.'><xsl:with-param name='collName' select='$collName'/></xsl:apply-templates> 112 </xsl:otherwise></xsl:choose> 113 </xsl:for-each> 114 </tr> 115 <tr valign='top'> 116 <xsl:for-each select='node|resource'> 117 <xsl:choose><xsl:when test='name()="node" and node|resource'><xsl:if test="$link='icon'"><td></td></xsl:if><xsl:apply-templates select='.' mode='process-all-children'><xsl:with-param name='collName' select='$collName'/><xsl:with-param name='link' select='$link'/></xsl:apply-templates></xsl:when> 118 <xsl:otherwise><td></td><xsl:if test="$link='icon'"><td></td></xsl:if> 119 </xsl:otherwise> 120 </xsl:choose> 121 </xsl:for-each></tr> 122 </table> 123 <xsl:call-template name="greenBar"/> 124 </xsl:template> 125 126 <!-- different template for resource, not used at the moment 127 priority attribute used to decide which template to use --> 128 <!-- 129 <xsl:template match="resource" priority="1"> 130 <xsl:param name="collName">coll-name</xsl:param> 131 <xsl:variable name='library' select='ancestor::page/config/library_name'/> 132 <xsl:variable name='year' select="metadataList/metadata[@name='Year']"/> 133 <xsl:variable name='month' select="metadataList/metadata[@name='Month']"/> 134 <td><b><xsl:if test="not($year = preceding-sibling::resource[1]/metadataList/metadata[@name='Year'])"><xsl:value-of select="$year"/></xsl:if></b></td> 135 <td><b><xsl:if test="not($year = preceding-sibling::resource[1]/metadataList/metadata[@name='Year'] and $month = preceding-sibling::resource[1]/metadataList/metadata[@name='Month'])"><xsl:value-of select="$month"/></xsl:if></b></td> 136 <td><a href="{$library}?a=r&c={$collName}&r={@name}"><img src='interfaces/default/images/book.gif' width='18' height='11' border='0'/></a></td><td><xsl:value-of select="metadataList/metadata[@name='Title']"/></td> 137 </xsl:template> 138 --> 90 139 91 140 <xsl:template match="resource"> 141 <xsl:param name="collName">coll-name</xsl:param> 92 142 <xsl:variable name='library' select='ancestor::page/config/library_name'/> 93 <td><a href="{$library}?a=r&c= mgppdemo&r={@name}">+++</a></td><td><xsl:value-of select="metadataList/metadata[@name='Title']"/></td>143 <td><a href="{$library}?a=r&c={$collName}&r={@name}"><img src='interfaces/default/images/book.gif' width='18' height='11' border='0'/></a></td><td><xsl:value-of select="metadataList/metadata[@name='Title']"/></td> 94 144 </xsl:template> 95 145 … … 98 148 99 149 <xsl:template match="node" mode="current-node"> 100 <xsl:param name="link" select="icon"/> 150 <xsl:param name="collName">coll-name</xsl:param> 151 <xsl:param name="link">icon</xsl:param> 101 152 <xsl:variable name="library" select="ancestor::page/config/library_name"/> 102 153 <xsl:choose><xsl:when test="$link='icon'"> 103 <td><a href="{$library}?a=b&c=mgppdemo&cl={@name}">***</a></td><td><xsl:value-of select="@name"/></td>154 <td><a><xsl:attribute name='href'><xsl:value-of select='$library'/>?a=b&sa=classifier&c=<xsl:value-of select='$collName'/>&cl=<xsl:value-of select='@name'/><xsl:if test="node|resource">.pr</xsl:if></xsl:attribute><img src='interfaces/default/images/bshelf.gif' border='0' width='20' height='16' /></a></td><td align='left'><xsl:value-of select="metadataList/metadata[@name='Title']"/></td> 104 155 </xsl:when><xsl:otherwise> 105 <td><a href="{$library}?a=b&c=mgppdemo&cl={@name}"><xsl:value-of select="@name"/></a></td>156 <td><a><xsl:attribute name='href'><xsl:value-of select='$library'/>?a=b&sa=classifier&c=<xsl:value-of select='$collName'/>&cl=<xsl:value-of select='@name'/><xsl:if test="node|resource">.pr</xsl:if></xsl:attribute><xsl:value-of select="metadataList/metadata[@name='Title']"/></a></td> 106 157 </xsl:otherwise></xsl:choose> 107 158 </xsl:template> … … 110 161 <!-- if interleave=true, process all child nodes and resources, else just do nodes --> 111 162 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'">163 164 <xsl:template match="node" mode="process-all-children"> 165 <xsl:param name="collName">coll-name</xsl:param> 166 <xsl:param name="link">icon</xsl:param> 116 167 <td><p/> 117 168 <xsl:choose><xsl:when test='@type="vertical"'> 118 169 <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 -->170 <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:with-param name='collName' select='$collName'/></xsl:apply-templates></tr><tr valign='top'><td></td><xsl:apply-templates select='.' mode='process-all-children'><xsl:with-param name='collName' select='$collName'/><xsl:with-param name='link' select='$link'/></xsl:apply-templates></tr> 171 </xsl:when> 172 <xsl:otherwise><tr valign='top'><xsl:apply-templates select='.'><xsl:with-param name='collName' select='$collName'/></xsl:apply-templates></tr> 173 </xsl:otherwise></xsl:choose> 123 174 </xsl:for-each></table> 124 175 </xsl:when> 125 <xsl:otherwise> <!-- type = vertical fails -->176 <xsl:otherwise> 126 177 <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>178 <xsl:choose><xsl:when test='name()="node"'><xsl:apply-templates select='.' mode='current-node'><xsl:with-param name='link' select='$link'/><xsl:with-param name='collName' select='$collName'/></xsl:apply-templates><xsl:apply-templates select='.' mode='process-all-children'><xsl:with-param name='collName' select='$collName'/><xsl:with-param name='link' select='$link'/></xsl:apply-templates> 128 179 </xsl:when> 129 180 <xsl:otherwise><xsl:apply-templates select='.'/> 130 </xsl:otherwise></xsl:choose> <!-- name=node -->181 </xsl:otherwise></xsl:choose> 131 182 </xsl:for-each> 132 183 </tr></table> 133 </xsl:otherwise></xsl:choose> <!-- end of orientation choice -->184 </xsl:otherwise></xsl:choose> 134 185 </td> 135 </xsl:when> 136 <xsl:otherwise> <!-- interleave = false --> 186 </xsl:template> 187 188 189 <xsl:template match="node" mode="process-node-children"> 190 <xsl:param name="collName">coll-name</xsl:param> 191 <xsl:param name="link">icon</xsl:param> 137 192 <td><p/> 138 193 <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>194 <table><xsl:for-each select='node'><tr valign='top'><xsl:apply-templates select='.' mode='current-node'><xsl:with-param name='link' select='$link'/><xsl:with-param name='collName' select='$collName'/></xsl:apply-templates></tr><tr valign='top'><td></td><xsl:apply-templates select='.' mode='process-node-children'><xsl:with-param name='collName' select='$collName'/><xsl:with-param name='link' select='$link'/></xsl:apply-templates></tr></xsl:for-each></table> 140 195 </xsl:when> 141 196 <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 -->197 <table><tr valign='top'><xsl:apply-templates select='node' mode='current-node'><xsl:with-param name='link' select='$link'/><xsl:with-param name='collName' select='$collName'/></xsl:apply-templates><xsl:apply-templates select='node' mode='process-node-children'><xsl:with-param name='collName' select='$collName'/><xsl:with-param name='link' select='$link'/></xsl:apply-templates></tr></table> 198 </xsl:otherwise></xsl:choose> 144 199 </td> 145 </xsl:otherwise>146 </xsl:choose> <!-- end of interleave choice -->147 200 </xsl:template> 148 201
Note:
See TracChangeset
for help on using the changeset viewer.