Project

General

Profile

metacat / lib / style / skins / first / first-item-resultset.xsl @ 4271

1
<?xml version="1.0"?>
2
<!--
3
	*  '$RCSfile$'
4
	*      Authors: Matt Jones, CHad Berkley
5
	*    Copyright: 2000 Regents of the University of California and the
6
	*               National Center for Ecological Analysis and Synthesis
7
	*  For Details: http://www.nceas.ucsb.edu/
8
	*
9
	*   '$Author: leinfelder $'
10
	*     '$Date: 2008-08-20 11:02:29 -0700 (Wed, 20 Aug 2008) $'
11
	* '$Revision: 4271 $'
12
	*
13
	* This program is free software; you can redistribute it and/or modify
14
	* it under the terms of the GNU General Public License as published by
15
	* the Free Software Foundation; either version 2 of the License, or
16
	* (at your option) any later version.
17
	*
18
	* This program is distributed in the hope that it will be useful,
19
	* but WITHOUT ANY WARRANTY; without even the implied warranty of
20
	* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
21
	* GNU General Public License for more details.
22
	*
23
	* You should have received a copy of the GNU General Public License
24
	* along with this program; if not, write to the Free Software
25
	* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
26
	*
27
	* This is an XSLT (http://www.w3.org/TR/xslt) stylesheet designed to
28
	* convert an XML file showing the resultset of a query
29
	* into an HTML format suitable for rendering with modern web browsers.
30
-->
31
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
32

    
33
	<xsl:output method="html" />
34
	<xsl:param name="sessid" />
35
	<xsl:param name="qformat">default</xsl:param>
36
	<xsl:param name="enableediting">false</xsl:param>
37
	<xsl:param name="contextURL"/>
38
	
39
	<xsl:template match="/">
40
		<script language="JavaScript">
41
          <![CDATA[
42
          submitform = function(action,form_ref) {
43
              form_ref.action.value=action;
44
              form_ref.sessionid.value="]]><xsl:value-of select="$sessid" /><![CDATA[";
45
              //form_ref.qformat.value="]]><xsl:value-of select="$qformat" /><![CDATA[";
46
              form_ref.submit();
47
          }
48

    
49
          ]]>
50
        </script>
51
        
52
        <p class="emphasis">
53
			<xsl:number value="count(resultset/document)" /> items found
54
		</p>
55

    
56
		<!-- This tests to see if there are returned documents,
57
			if there are not then don't show the query results -->
58
		<xsl:if test="count(resultset/document) &gt; 0">
59

    
60
			<table width="95%" align="left" border="0" cellpadding="0"
61
				cellspacing="0">
62

    
63
				<xsl:for-each select="resultset/document">
64
					<xsl:sort select="./param[@name='item/@title']" />
65
					<tr valign="top">
66
						<xsl:attribute name="class">
67
							<xsl:choose>
68
								<xsl:when test="position() mod 2 = 1">rowodd</xsl:when>
69
								<xsl:when test="position() mod 2 = 0">roweven</xsl:when>
70
							</xsl:choose>
71
						</xsl:attribute>
72

    
73
						<td class="text_plain">
74
							<a>
75
								<xsl:attribute name="href">javascript:submitform('read',document.<xsl:value-of select="translate(./docid, '()-.', '____')" />)</xsl:attribute>
76
								<xsl:text>&#187;&#160;</xsl:text>
77
								<xsl:value-of select="./param[@name='item/@title']" />
78
								<!-- <xsl:value-of select="./param[@name='item/@ident']" />-->
79
							</a>
80
							(<xsl:value-of select="./docid" />)
81
							<form action="{$contextURL}/metacat" method="POST">
82
								<xsl:attribute name="name">
83
									<xsl:value-of select="translate(./docid, '()-.', '____')" />
84
								</xsl:attribute>
85

    
86
								<input type="hidden" name="qformat" value="first"/>
87
								<input type="hidden" name="sessionid" />
88
								<xsl:if	test="$enableediting = 'true'">
89
									<input type="hidden"
90
										name="enableediting" value="{$enableediting}" />
91
								</xsl:if>
92
								<input type="hidden" name="action" value="read" />
93
								<input type="hidden" name="docid">
94
									<xsl:attribute name="value">
95
										<xsl:value-of select="./docid" />
96
									</xsl:attribute>
97
								</input>
98
								<xsl:for-each select="./relation">
99
									<input type="hidden" name="docid">
100
										<xsl:attribute name="value">
101
											<xsl:value-of select="./relationdoc" />
102
										</xsl:attribute>
103
									</input>
104
								</xsl:for-each>
105
							</form>	
106
						</td>
107
						
108
						<td class="text_plain">
109
							<xsl:for-each select="./param[@name='presentation/flow/material/mattext']">
110
								<xsl:value-of select="."/>
111
								<br/>
112
							</xsl:for-each>	
113
							
114
							<ul>
115
							<xsl:for-each
116
								select="./param[@name='response_label/material/mattext']">
117
								<li>
118
									<xsl:value-of select="." />
119
								</li>	
120
							</xsl:for-each>
121
							</ul>
122
						</td>
123
						
124
						<td>
125
							<table>
126
								<tr valign="top">
127
									<td class="text_plain" colspan="2">
128
										Metadata
129
									</td>
130
								</tr>
131
								<tr valign="top">
132
									<td class="text_plain" colspan="2">
133
										Vocabulary:
134
										<xsl:for-each
135
											select="./param[@name='vocabulary']">
136
											<xsl:value-of select="." />
137
											<br />
138
										</xsl:for-each>
139
									</td>
140
								</tr>
141
								<tr valign="top">
142
									<td class="text_plain" nowrap="nowrap">
143
										<xsl:for-each
144
											select="./param[@name='fieldlabel']">
145
											<xsl:value-of select="." />:
146
											<br />
147
										</xsl:for-each>
148
									</td>
149
									
150
									<td class="text_plain" nowrap="nowrap">
151
										<xsl:for-each
152
											select="./param[@name='fieldentry']">
153
											<xsl:value-of select="." />
154
											<br />
155
										</xsl:for-each>
156
									</td>
157
								</tr>
158
							</table>
159
						</td>
160

    
161
					</tr>
162
					<!-- 
163
					<tr>
164
						<td class="text_plain">
165
							<xsl:for-each
166
								select="./param[@name='objectives/material/mattext']">
167
								<xsl:value-of select="." />
168
								<br />
169
							</xsl:for-each>
170
						</td>
171
					</tr>
172
					-->
173
					<tr class="searchresultsdivider">
174
						<td colspan="3">
175
							<img
176
								src="{$contextURL}/style/skins/default/images/transparent1x1.gif"
177
								width="1" height="1" />
178
						</td>
179
					</tr>
180

    
181
				</xsl:for-each>
182
			</table>
183

    
184
		</xsl:if>
185
	</xsl:template>
186

    
187
</xsl:stylesheet>