- Timestamp:
- 2003-06-18T12:08:01+12:00 (21 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gsdl3/web/interfaces/default/transform/document.xsl
r4288 r4712 1 1 <?xml version="1.0" encoding="ISO-8859-1"?> 2 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 extension-element-prefixes="java"> 6 7 <xsl:include href="style.xsl"/> 8 <xsl:include href="service-params.xsl"/> 9 <xsl:output method="html"/> 10 <!-- 11 <xsl:output method="xml"/> 12 --> 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 extension-element-prefixes="java util" 7 exclude-result-prefixes="java util"> 8 9 <xsl:include href="style.xsl"/> 10 <xsl:include href="service-params.xsl"/> 11 <xsl:output method="html"/> 12 <!-- 13 <xsl:output method="xml"/> 14 --> 13 15 14 16 <xsl:template name="pageHead"> 15 <xsl:variable name="docID" select=" ancestor::page/pageResponse/document/@selectedNode"/>17 <xsl:variable name="docID" select="/page/pageResponse/document/@selectedNode"/> 16 18 <head> 17 <title><xsl:for-each select=' ancestor::page/pageResponse/document/descendant::documentNode[@nodeID=$docID]/ancestor-or-self::documentNode'><xsl:if test='position()!=1'>::</xsl:if><xsl:value-of select="metadataList/metadata[@name='Title']"/></xsl:for-each></title>19 <title><xsl:for-each select='/page/pageResponse/document/descendant::documentNode[@nodeID=$docID]/ancestor-or-self::documentNode'><xsl:if test='position()!=1'>::</xsl:if><xsl:value-of select="metadataList/metadata[@name='Title']"/></xsl:for-each></title> 18 20 <xsl:call-template name="css-style"/> 19 21 </head> … … 34 36 35 37 <xsl:template match="pageResponse"> 36 <xsl:variable name="collName"><xsl:value-of select=" ancestor::page/pageRequest/paramList/param[@name='c']/@value"/></xsl:variable>38 <xsl:variable name="collName"><xsl:value-of select="/page/pageRequest/paramList/param[@name='c']/@value"/></xsl:variable> 37 39 <center> 38 40 <xsl:call-template name="collectionPageBanner"> … … 41 43 42 44 <!-- display the document --> 43 <xsl: call-template name="display-document">45 <xsl:apply-templates select="document"> 44 46 <xsl:with-param name="collName" select="$collName"/> 45 </xsl: call-template>47 </xsl:apply-templates> 46 48 </center> 47 49 … … 49 51 </xsl:template> 50 52 51 <xsl:template name="display-document"> 52 <xsl:param name="collName"/> 53 <!-- Display table of contents --> 53 <xsl:template match="document"> 54 <xsl:param name="collName"/> 54 55 <p/> 56 <xsl:call-template name="documentHeading"> 57 <xsl:with-param name="collName" select="$collName"/> 58 </xsl:call-template> 59 <p/> 60 <xsl:call-template name="documentContent"> 61 <xsl:with-param name="collName" select="$collName"/> 62 </xsl:call-template> 63 </xsl:template> 64 65 <!-- hierarchical document --> 66 <xsl:template name="documentHeading"> 67 <xsl:param name="collName"/> 55 68 <table width="537" cellpadding="0" cellspacing="0"> 56 69 <tr> 57 <!-- modes are table-of-contents and paged-naviagtion--> 58 <!--<xsl:apply-templates select="document" mode='paged-navigation'>--> 59 <xsl:apply-templates select="document" mode='table-of-contents'> 70 <td valign="top" align="left" width="200"> 71 <xsl:call-template name="coverImage"/> 72 <p/> 73 <xsl:call-template name="enrichServices"> 74 <xsl:with-param name="collName" select="$collName"/> 75 </xsl:call-template> 76 </td> 77 <td valign="top"> 78 <xsl:call-template name="TOC"> 79 <xsl:with-param name="collName" select="$collName"/> 80 </xsl:call-template> 81 </td> 82 </tr> 83 </table> 84 </xsl:template> 85 86 <xsl:template name="coverImage"> 87 <img><xsl:attribute name='src'><xsl:value-of select="/page/pageResponse/collection/metadataList/metadata[@name='httpPath']"/>/index/assoc/<xsl:value-of select="metadataList/metadata[@name='archivedir']"/>/cover.jpg</xsl:attribute></img> 88 </xsl:template> 89 90 <xsl:template name="TOC"> 91 <xsl:param name="collName"/> 92 <xsl:choose> 93 <xsl:when test="@documentType='hierarchy'"> 94 <xsl:call-template name="hierarchicalContents"> 60 95 <xsl:with-param name="collName" select="$collName"/> 61 </xsl:apply-templates> 62 </tr> 63 </table> 96 </xsl:call-template> 97 </xsl:when> 98 <xsl:when test="@documentType='paged'"> 99 <xsl:call-template name="pagedContents"> 100 <xsl:with-param name="collName" select="$collName"/> 101 </xsl:call-template> 102 </xsl:when> 103 <xsl:otherwise> 104 <!-- just print the title of teh one and only docNode --> 105 <xsl:value-of select="documentNode/metadataList/metadata[@name='Title']"/> 106 </xsl:otherwise> 107 </xsl:choose> 108 </xsl:template> 109 110 <xsl:template name="hierarchicalContents"> 111 <xsl:param name="collName"/> 112 <xsl:apply-templates select="documentNode[@nodeID]"> 113 <xsl:with-param name="collName" select="$collName"/> 114 <xsl:with-param name="depth" select="0"/> 115 </xsl:apply-templates> 116 </xsl:template> 117 118 <xsl:template match="documentNode"> 119 <xsl:param name="collName"/> 120 <xsl:param name="depth"/> 121 <xsl:variable name="space" select="$depth * 25"/> 64 122 65 <!-- Display document content --> 123 <table> 124 <tr valign="top"> 125 <td> 126 <xsl:if test="not($depth = '0')"> 127 <img src="interfaces/default/images/space.gif" width="{$space}"/> 128 </xsl:if> 129 </td> 130 131 <!-- Display the appropriate image, depending on the node type --> 132 <td valign="top"> 133 <a><xsl:attribute name="href"><xsl:value-of select='$library_name'/>?a=d&c=<xsl:value-of select='$collName'/>&d=<xsl:value-of select='@nodeID'/><xsl:if test="documentNode">.pr</xsl:if><xsl:if test="@nodeType='leaf'">&sib=1</xsl:if></xsl:attribute> 134 <xsl:apply-templates select="." mode="displayNodeIcon"/> 135 </a> 136 </td> 137 138 <!-- Display associated title, bolded if the node has content --> 139 <td valign="top"> 140 <xsl:choose> 141 <xsl:when test="nodeContent"> 142 <b><xsl:value-of select="metadataList/metadata[@name='Title']"/></b> 143 </xsl:when> 144 <xsl:otherwise> 145 <xsl:value-of select="metadataList/metadata[@name='Title']"/> 146 </xsl:otherwise> 147 </xsl:choose> 148 </td> 149 </tr> 150 </table> 151 <!-- Apply recursively to the children of this node --> 152 <xsl:apply-templates select="documentNode[@nodeID]"> 153 <xsl:with-param name="collName" select="$collName"/> 154 <xsl:with-param name="depth" select="$depth + 1"/> 155 </xsl:apply-templates> 156 </xsl:template> 157 158 159 <!-- default content is to process any nodeContent elements and print out their text --> 160 <xsl:template name="documentContent"> 66 161 <xsl:apply-templates select="descendant::documentNode/nodeContent"/> 67 162 </xsl:template> 163 68 164 69 165 <!-- the actual text/content --> … … 84 180 </xsl:template> 85 181 86 87 <xsl:template match="annotation"><span class="{@type}"><xsl:value-of disable-output-escaping="yes" select="."/></span></xsl:template> 88 89 <xsl:template match="document" mode="table-of-contents"> 90 <xsl:param name="collName"/> 91 <xsl:variable name="httpPath" select="ancestor::pageResponse/collection/metadataList/metadata[@name='httpPath']"/> 92 <xsl:variable name="archivedir" select="metadataList/metadata[@name='archivedir']"/> 93 <!-- Display cover image --> 94 <td valign="top" align="left" width="200"> 95 <img><xsl:attribute name='src'><xsl:value-of select="ancestor::pageResponse/collection/metadataList/metadata[@name='httpPath']"/>/index/assoc/<xsl:value-of select="metadataList/metadata[@name='archivedir']"/>/cover.jpg</xsl:attribute></img> 96 <p /> 97 <!-- display the enrich service options here --> 98 <xsl:apply-templates select="../serviceList"> 99 <xsl:with-param name="collName" select="$collName"/> 100 </xsl:apply-templates> 101 102 </td> 103 <!-- Display the hierarchical structure --> 104 <td valign="top"> 105 <xsl:apply-templates select="documentNode[@nodeID]"> 106 <xsl:with-param name="collName" select="$collName"/> 107 <xsl:with-param name="depth" select="0"/> 108 </xsl:apply-templates> 109 </td> 110 111 </xsl:template> 112 182 <!-- match any annotations and make them span elements --> 183 <xsl:template match="annotation"> 184 <span class="{@type}"><xsl:value-of disable-output-escaping="yes" select="."/></span> 185 </xsl:template> 186 187 188 113 189 <!-- paged naviagtion : INCOMPLETE!!--> 114 <xsl:template match="document" mode="paged-navigation"> 115 <xsl:param name="collName"/> 116 <xsl:variable name="library" select="ancestor::page/config/library_name"/> 190 <xsl:template name="pagedContents"> 191 <xsl:param name="collName"/> 117 192 <xsl:variable name="pos" select="nodeStructureInfo/info[@name='siblingPosition']/@value"/> 118 193 <xsl:variable name="length" select="nodeStructureInfo/info[@name='numSiblings']/@value"/> 119 194 <xsl:variable name="children" select="nodeStructureInfo/info[@name='numChildren']/@value"/> 120 <td valign="left"> 121 <table> 122 <xsl:choose> 123 <xsl:when test="$pos=-1"><!-- a doc --> 124 <tr valign="top"> 125 <td align="left"> 126 </td> 127 <td align="center"><center> 128 <b><xsl:value-of select="$children"/> pages.</b> 129 </center></td> 130 <td align="right"> 131 <a href="{$library}?a=d&c={$collName}&d={@selectedNode}.fc"><img src="interfaces/nzdl/images/more.gif" border="0" align="absbottom" /></a> 132 </td> 133 </tr> 134 </xsl:when> 135 136 <xsl:otherwise> <!-- an internal node --> 137 <tr valign="top"> 138 <td align="left"> 139 <xsl:if test=" not ( $pos = 1 )"> 140 <a href="{$library}?a=d&c={$collName}&d={@selectedNode}.ps"><img src="interfaces/nzdl/images/less.gif" border="0" align="absbottom" /></a> 141 </xsl:if> 142 </td> 143 <td align="center"><center> 144 <b>Page <xsl:value-of select="$pos"/> of <xsl:value-of select="$length"/>.</b> 145 </center></td> 146 <td align="right"> 147 <xsl:if test=" not($pos = $length)"> 148 <a href="{$library}?a=d&c={$collName}&d={@selectedNode}.ns"><img src="interfaces/nzdl/images/more.gif" border="0" align="absbottom" /></a> 149 </xsl:if> 150 </td> 151 </tr> 152 </xsl:otherwise> 153 </xsl:choose> 154 <tr valign="middle"> 155 <td align='center' valign='top' colspan='3'> goto form 156 </td> 157 </tr> 195 <table> 196 <xsl:choose> 197 <xsl:when test="$pos=-1"><!-- a doc --> 198 <tr valign="top"> 199 <td align="left"> 200 </td> 201 <td align="center"><center> 202 <b><xsl:value-of select="$children"/> pages.</b> 203 </center></td> 204 <td align="right"> 205 <a href="{$library_name}?a=d&c={$collName}&d={@selectedNode}.fc"><img src="interfaces/nzdl/images/more.gif" border="0" align="absbottom" /></a> 206 </td> 207 </tr> 208 </xsl:when> 209 210 <xsl:otherwise> <!-- an internal node --> 211 <tr valign="top"> 212 <td align="left"> 213 <xsl:if test=" not ( $pos = 1 )"> 214 <a href="{$library_name}?a=d&c={$collName}&d={@selectedNode}.ps"><img src="interfaces/nzdl/images/less.gif" border="0" align="absbottom" /></a> 215 </xsl:if> 216 </td> 217 <td align="center"><center> 218 <b>Page <xsl:value-of select="$pos"/> of <xsl:value-of select="$length"/>.</b> 219 </center></td> 220 <td align="right"> 221 <xsl:if test=" not($pos = $length)"> 222 <a href="{$library_name}?a=d&c={$collName}&d={@selectedNode}.ns"><img src="interfaces/nzdl/images/more.gif" border="0" align="absbottom" /></a> 223 </xsl:if> 224 </td> 225 </tr> 226 </xsl:otherwise> 227 </xsl:choose> 228 <tr valign="middle"> 229 <td align='center' valign='top' colspan='3'> goto form 230 </td> 231 </tr> 232 </table> 233 </xsl:template> 234 235 <xsl:template name="enrichServices"> 236 <xsl:param name="collName"/> 237 <xsl:variable name="docID" select="/page/pageRequest/paramList/param[@name='d']/@value"/> 238 <xsl:for-each select="../serviceList/service"> 239 <table border='1' cellspacing='0'> 240 <tr><td> 241 <p /><xsl:value-of select="display/name"/><p/> 242 <form name="EnrichForm" method="get" action="/gsdl3/{$library_name}"> 243 <xsl:apply-templates select="paramList"/> 244 <input type='hidden' name='a' value='d'/> 245 <input type='hidden' name='d' value='{$docID}'/> 246 <input type='hidden' name='c' value='{$collName}'/> 247 <xsl:if test='/page/pageRequest/paramList/param[@name="sib"]'> 248 <input type='hidden' name='sib'><xsl:attribute name='value'><xsl:value-of select='/page/pageRequest/paramList/param[@name="sib"]/@value'/></xsl:attribute></input></xsl:if> 249 <input type='hidden' name='s' value='{@name}'/> 250 <input type="submit"><xsl:attribute name="value"><xsl:value-of select='display/submit'/></xsl:attribute></input> 251 </form> 252 </td></tr> 158 253 </table> 159 </td>160 <td valign="top" align="right" width="200">161 <img><xsl:attribute name='src'><xsl:value-of select="ancestor::pageResponse/collection/metadataList/metadata[@name='httpPath']"/>/index/assoc/<xsl:value-of select="metadataList/metadata[@name='archivedir']"/>/cover.jpg</xsl:attribute></img>162 <p />163 <!-- display the enrich service options here -->164 <xsl:apply-templates select="../serviceList">165 <xsl:with-param name="collName" select="$collName"/>166 </xsl:apply-templates>167 168 </td>169 </xsl:template>170 171 172 173 <xsl:template match="documentNode">174 <xsl:param name="collName"/>175 <xsl:param name="depth"/>176 <xsl:variable name="library" select="ancestor::page/pageExtra/config/library_name"/>177 <xsl:variable name="space" select="$depth * 25"/>178 179 <table>180 <tr valign="top">181 <td>182 <xsl:if test="not($depth = '0')">183 <img src="interfaces/default/images/space.gif" width="{$space}"/>184 </xsl:if>185 </td>186 187 <!-- Display the appropriate image, depending on the node type -->188 <td valign="top">189 <a><xsl:attribute name="href"><xsl:value-of select='$library'/>?a=d&c=<xsl:value-of select='$collName'/>&d=<xsl:value-of select='@nodeID'/><xsl:if test="documentNode">.pr</xsl:if><xsl:if test="@nodeType='leaf'">&sib=1</xsl:if></xsl:attribute>190 <xsl:apply-templates select="." mode="displayNodeIcon"/>191 </a>192 </td>193 194 <!-- Display associated title, bolded if the node has content -->195 <td valign="top">196 <xsl:choose>197 <xsl:when test="nodeContent">198 <b><xsl:value-of select="metadataList/metadata[@name='Title']"/></b>199 </xsl:when>200 <xsl:otherwise>201 <xsl:value-of select="metadataList/metadata[@name='Title']"/>202 </xsl:otherwise>203 </xsl:choose>204 </td>205 </tr>206 </table>207 208 209 <!-- Apply recursively to the children of this node -->210 <xsl:apply-templates select="documentNode[@nodeID]">211 <xsl:with-param name="collName" select="$collName"/>212 <xsl:with-param name="depth" select="$depth + 1"/>213 </xsl:apply-templates>214 </xsl:template>215 216 217 218 <xsl:template match="serviceList">219 <xsl:param name="collName"/>220 <xsl:variable name="docID" select="ancestor::page/pageRequest/paramList/param[@name='d']/@value"/>221 <xsl:variable name='library' select='ancestor::page/pageExtra/config/library_name'/>222 <xsl:for-each select="service">223 <table border='1' cellspacing='0'><tr><td>224 <p /><xsl:value-of select="display/name"/><p/>225 <form name="EnrichForm" method="get" action="/gsdl3/{$library}">226 <xsl:apply-templates select="paramList"/>227 <input type='hidden' name='a' value='d'/>228 <input type='hidden' name='d' value='{$docID}'/>229 <input type='hidden' name='c' value='{$collName}'/>230 <xsl:if test='ancestor::page/pageRequest/paramList/param[@name="sib"]'>231 <input type='hidden' name='sib'><xsl:attribute name='value'><xsl:value-of select='ancestor::page/pageRequest/paramList/param[@name="sib"]/@value'/></xsl:attribute></input></xsl:if>232 <input type='hidden' name='s' value='{@name}'/>233 <input type="submit"><xsl:attribute name="value"><xsl:value-of select='display/submit'/></xsl:attribute></input>234 </form>235 </td></tr></table>236 254 </xsl:for-each> 237 255 </xsl:template> … … 240 258 <xsl:for-each select="param"> 241 259 <input type='hidden' name='{@name}' value='{@value}'/><xsl:text> 242 260 </xsl:text> 243 261 </xsl:for-each> 244 262 </xsl:template> 245 263 246 264 <xsl:template match="paramList"> 247 <p/><table>248 <xsl:for-each select="param">249 250 251 252 253 254 255 256 257 258 259 </xsl:for-each>260 </table>261 </xsl:template>262 265 <p/><table> 266 <xsl:for-each select="param"> 267 <xsl:choose> 268 <xsl:when test="@type='multi'"> 269 <tr><td colspan='2'> 270 <xsl:apply-templates select='.'/></td></tr> 271 </xsl:when> 272 <xsl:otherwise> 273 <xsl:variable name="pname" select="@name"/> 274 <tr><td><xsl:value-of select='ancestor::service/display/param[@name=$pname]/name'/></td><td align="right"><xsl:apply-templates select="."/></td></tr> 275 </xsl:otherwise> 276 </xsl:choose> 277 </xsl:for-each> 278 </table> 279 </xsl:template> 280 263 281 </xsl:stylesheet> 264 282
Note:
See TracChangeset
for help on using the changeset viewer.