source: trunk/gsdl3/web/interfaces/default/transform/document.xsl@ 4149

Last change on this file since 4149 was 4146, checked in by kjdon, 21 years ago

all stuff for the page generated by teh Receptionist (config and display) is now put into a pageExtra element

  • Property svn:keywords set to Author Date Id Revision
File size: 7.0 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 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-->
13
14 <xsl:template name="pageHead">
15 <xsl:variable name="docID" select="ancestor::page/pageResponse/document/@selectedNode"/>
16 <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>
18 <xsl:call-template name="css-style"/>
19 </head>
20 </xsl:template>
21
22<!-- this is hard coded for GATE, should somehow do it dynamically-->
23 <xsl:template name="css-style">
24 <style type="text/css">
25 <xsl:text disable-output-escaping="yes">
26 span.Location { display:inline; color : red }
27 span.Person { display:inline; color : green }
28 span.Organization { display:inline; color : yellow }
29 span.Date { display:inline; color : blue }
30 </xsl:text>
31 </style>
32 </xsl:template>
33
34 <xsl:template match="pageResponse">
35 <xsl:variable name="collName"><xsl:value-of select="ancestor::page/pageRequest/paramList/param[@name='c']/@value"/></xsl:variable>
36 <center>
37 <xsl:call-template name="collectionPageBanner">
38 <xsl:with-param name="collName" select="$collName"/>
39 </xsl:call-template>
40
41 <!-- Display table of contents -->
42 <p/>
43 <table width="537" cellpadding="0" cellspacing="0">
44 <tr>
45 <xsl:apply-templates select="document">
46 <xsl:with-param name="collName" select="$collName"/>
47 </xsl:apply-templates>
48 </tr>
49 </table>
50
51 <!-- Display document content -->
52 <xsl:apply-templates select="descendant::documentNode/nodeContent"/>
53 </center>
54 <xsl:call-template name="greenBar"/>
55</xsl:template>
56
57
58<xsl:template match="nodeContent">
59 <p/>
60 <table width="537" cellpadding="0" cellspacing="0">
61 <tr>
62 <td align="left">
63 <xsl:for-each select="node()">
64 <xsl:choose>
65 <xsl:when test="not(name())"><xsl:value-of select="." disable-output-escaping="yes"/></xsl:when>
66 <xsl:otherwise><xsl:apply-templates select="."/></xsl:otherwise>
67 </xsl:choose>
68 </xsl:for-each>
69 </td>
70 </tr>
71 </table>
72</xsl:template>
73
74
75<xsl:template match="annotation">
76 <span class="{@type}"><xsl:value-of disable-output-escaping="yes" select="."/></span></xsl:template>
77
78
79<xsl:template match="document">
80 <xsl:param name="collName"/>
81 <xsl:variable name="httpPath" select="ancestor::pageResponse/collection/metadataList/metadata[@name='httpPath']"/>
82 <xsl:variable name="assocfilepath" select="metadataList/metadata[@name='assocfilepath']"/>
83 <!-- Display table of contents -->
84 <td valign="top" align="left" width="200">
85 <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='assocfilepath']"/>/cover.jpg</xsl:attribute></img>
86 <p />
87 <!-- display the enrich service options here -->
88 <xsl:apply-templates select="../serviceList">
89 <xsl:with-param name="collName" select="$collName"/>
90 </xsl:apply-templates>
91
92 </td>
93 <td valign="top">
94 <xsl:apply-templates select="documentNode[@nodeID]">
95 <xsl:with-param name="collName" select="$collName"/>
96 <xsl:with-param name="depth" select="0"/>
97 </xsl:apply-templates>
98 </td>
99</xsl:template>
100
101
102<xsl:template match="documentNode">
103 <xsl:param name="collName"/>
104 <xsl:param name="depth"/>
105 <xsl:variable name="library" select="ancestor::page/pageExtra/config/library_name"/>
106 <xsl:variable name="space" select="$depth * 25"/>
107
108 <table>
109 <tr valign="top">
110 <td>
111 <xsl:if test="not($depth = '0')">
112 <img src="interfaces/default/images/space.gif" width="{$space}"/>
113 </xsl:if>
114 </td>
115
116 <!-- Display the appropriate image, depending on the node type -->
117 <td valign="top">
118 <a><xsl:attribute name="href"><xsl:value-of select='$library'/>?a=d&amp;c=<xsl:value-of select='$collName'/>&amp;d=<xsl:value-of select='@nodeID'/><xsl:if test="documentNode">.pr</xsl:if><xsl:if test="@nodeType='leaf'">&amp;sib=1</xsl:if></xsl:attribute>
119 <xsl:apply-templates select="." mode="displayNodeIcon"/>
120 </a>
121 </td>
122
123 <!-- Display associated title, bolded if the node has content -->
124 <td valign="top">
125 <xsl:choose>
126 <xsl:when test="nodeContent">
127 <b><xsl:value-of select="metadataList/metadata[@name='Title']"/></b>
128 </xsl:when>
129 <xsl:otherwise>
130 <xsl:value-of select="metadataList/metadata[@name='Title']"/>
131 </xsl:otherwise>
132 </xsl:choose>
133 </td>
134 </tr>
135 </table>
136
137 <!-- Apply recursively to the children of this node -->
138 <xsl:apply-templates select="documentNode[@nodeID]">
139 <xsl:with-param name="collName" select="$collName"/>
140 <xsl:with-param name="depth" select="$depth + 1"/>
141 </xsl:apply-templates>
142</xsl:template>
143
144 <xsl:template match="serviceList">
145 <xsl:param name="collName"/>
146 <xsl:variable name="docID" select="ancestor::page/pageRequest/paramList/param[@name='d']/@value"/>
147 <xsl:variable name='library' select='ancestor::page/pageExtra/config/library_name'/>
148 <xsl:for-each select="service">
149 <table border='1' cellspacing='0'><tr><td>
150 <p /><xsl:value-of select="display/name"/><p/>
151 <form name="EnrichForm" method="get" action="/gsdl3/{$library}">
152 <xsl:apply-templates select="paramList"/>
153 <input type='hidden' name='a' value='d'/>
154 <input type='hidden' name='d' value='{$docID}'/>
155 <input type='hidden' name='c' value='{$collName}'/>
156 <xsl:if test='ancestor::page/pageRequest/paramList/param[@name="sib"]'>
157 <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>
158 <input type='hidden' name='s' value='{@name}'/>
159 <input type="submit"><xsl:attribute name="value"><xsl:value-of select='display/submit'/></xsl:attribute></input>
160 </form>
161 </td></tr></table>
162 </xsl:for-each>
163 </xsl:template>
164
165 <xsl:template match="paramList" mode="hidden">
166 <xsl:for-each select="param">
167 <input type='hidden' name='{@name}' value='{@value}'/><xsl:text>
168 </xsl:text>
169 </xsl:for-each>
170 </xsl:template>
171
172 <xsl:template match="paramList">
173 <p/><table>
174 <xsl:for-each select="param">
175 <xsl:choose>
176 <xsl:when test="@type='multi'">
177 <tr><td colspan='2'>
178 <xsl:apply-templates select='.'/></td></tr>
179 </xsl:when>
180 <xsl:otherwise>
181 <xsl:variable name="pname" select="@name"/>
182 <tr><td><xsl:value-of select='ancestor::service/display/param[@name=$pname]/name'/></td><td align="right"><xsl:apply-templates select="."/></td></tr>
183 </xsl:otherwise>
184 </xsl:choose>
185 </xsl:for-each>
186 </table>
187</xsl:template>
188
189</xsl:stylesheet>
190
191
192
193
Note: See TracBrowser for help on using the repository browser.