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

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

now displays small forms for additional enrich services that may be available for transforming the doc in some way

  • Property svn:keywords set to Author Date Id Revision
File size: 6.1 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 <p/>
53 <table width="537" cellpadding="0" cellspacing="0">
54 <tr>
55 <td align="left">
56 <xsl:value-of disable-output-escaping="yes" select="descendant::documentNode/nodeContent"/>
57 </td>
58 </tr>
59 </table>
60 </center>
61 <xsl:call-template name="greenBar"/>
62 </xsl:template>
63
64
65<xsl:template match="document">
66 <xsl:param name="collName"/>
67
68 <!-- Display table of contents -->
69 <td valign="top" align="left" width="200">
70 <img src="cover.jpg"/> <!-- TO DO -->
71 <p />
72 <!-- display the enrich service options here -->
73 <xsl:apply-templates select="../serviceList">
74 <xsl:with-param name="collName" select="$collName"/>
75 </xsl:apply-templates>
76
77 </td>
78 <td valign="top">
79 <xsl:apply-templates select="documentNode[@nodeID]">
80 <xsl:with-param name="collName" select="$collName"/>
81 <xsl:with-param name="depth" select="0"/>
82 </xsl:apply-templates>
83 </td>
84</xsl:template>
85
86
87<xsl:template match="documentNode">
88 <xsl:param name="collName"/>
89 <xsl:param name="depth"/>
90 <xsl:variable name="library" select="ancestor::page/config/library_name"/>
91 <xsl:variable name="space" select="$depth * 25"/>
92
93 <table>
94 <tr valign="top">
95 <td>
96 <xsl:if test="not($depth = '0')">
97 <img src="interfaces/default/images/space.gif" width="{$space}"/>
98 </xsl:if>
99 </td>
100
101 <!-- Display the appropriate image, depending on the node type -->
102 <td valign="top">
103 <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>
104 <xsl:apply-templates select="." mode="displayNodeIcon"/>
105 </a>
106 </td>
107
108 <!-- Display associated title, bolded if the node has content -->
109 <td valign="top">
110 <xsl:choose>
111 <xsl:when test="nodeContent">
112 <b><xsl:value-of select="metadataList/metadata[@name='Title']"/></b>
113 </xsl:when>
114 <xsl:otherwise>
115 <xsl:value-of select="metadataList/metadata[@name='Title']"/>
116 </xsl:otherwise>
117 </xsl:choose>
118 </td>
119 </tr>
120 </table>
121
122 <!-- Apply recursively to the children of this node -->
123 <xsl:apply-templates select="documentNode[@nodeID]">
124 <xsl:with-param name="collName" select="$collName"/>
125 <xsl:with-param name="depth" select="$depth + 1"/>
126 </xsl:apply-templates>
127</xsl:template>
128
129 <xsl:template match="serviceList">
130 <xsl:param name="collName"/>
131 <xsl:variable name="docID" select="ancestor::page/pageRequest/paramList/param[@name='d']/@value"/>
132 <xsl:variable name='library' select='ancestor::page/config/library_name'/>
133 <xsl:for-each select="service">
134 <table border='1' cellspacing='0'><tr><td>
135 <p /><xsl:value-of select="display/name"/><p/>
136 <form name="EnrichForm" method="get" action="/gsdl3/{$library}">
137 <xsl:apply-templates select="paramList"/>
138 <input type='hidden' name='a' value='d'/>
139 <input type='hidden' name='d' value='{$docID}'/>
140 <input type='hidden' name='c' value='{$collName}'/>
141 <xsl:if test='ancestor::page/pageRequest/paramList/param[@name="sib"]'>
142 <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>
143 <input type='hidden' name='s' value='{@name}'/>
144 <input type="submit"><xsl:attribute name="value"><xsl:value-of select='display/submit'/></xsl:attribute></input>
145 </form>
146 </td></tr></table>
147 </xsl:for-each>
148 </xsl:template>
149
150 <xsl:template match="paramList" mode="hidden">
151 <xsl:for-each select="param">
152 <input type='hidden' name='{@name}' value='{@value}'/><xsl:text>
153 </xsl:text>
154 </xsl:for-each>
155 </xsl:template>
156
157 <xsl:template match="paramList">
158 <p/><table>
159 <xsl:for-each select="param">
160 <xsl:choose>
161 <xsl:when test="@type='multi'">
162 <tr><td colspan='2'>
163 <xsl:apply-templates select='.'/></td></tr>
164 </xsl:when>
165 <xsl:otherwise>
166 <xsl:variable name="pname" select="@name"/>
167 <tr><td><xsl:value-of select='ancestor::service/display/param[@name=$pname]/name'/></td><td align="right"><xsl:apply-templates select="."/></td></tr>
168 </xsl:otherwise>
169 </xsl:choose>
170 </xsl:for-each>
171 </table>
172</xsl:template>
173
174</xsl:stylesheet>
175
176
177
178
Note: See TracBrowser for help on using the repository browser.