Project

General

Profile

1 2950 berkley
<?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$'
10
*     '$Date$'
11
* '$Revision$'
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 3178 sledge
<xsl:stylesheet
32
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
33
    xmlns="http://www.w3.org/1999/xhtml"
34
    version="1.0">
35 2950 berkley
36 3178 sledge
  <xsl:output method="xml" encoding="utf-8"
37
              doctype-public="-//W3C//DTD XHTML 1.1//EN"
38
              doctype-system="http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"
39
              indent="yes" />
40
41 2950 berkley
  <xsl:param name="sessid"/>
42
  <xsl:param name="qformat">default</xsl:param>
43
  <xsl:param name="enableediting">false</xsl:param>
44 3178 sledge
45 2950 berkley
  <xsl:template match="/">
46 3178 sledge
    <html xml:lang="en-US">
47 2950 berkley
      <head>
48 3178 sledge
        <title>Components Search Results</title>
49
        <link rel="stylesheet" type="text/css"
50
            href="@style-skins-path@/{$qformat}/{$qformat}.css" />
51 2950 berkley
        <script language="Javascript" type="text/JavaScript"
52 3180 sledge
            src="@style-skins-path@/{$qformat}/{$qformat}.js">
53
          <xsl:text disable-output-escaping="yes">
54
          </xsl:text>
55
        </script>
56 2950 berkley
        <script language="Javascript" type="text/JavaScript"
57 3180 sledge
            src="@style-common-path@/branding.js">
58
          <xsl:text disable-output-escaping="yes">
59
          </xsl:text>
60
        </script>
61 3178 sledge
        <style type="text/css">
62 2950 berkley
63 3178 sledge
a
64
{
65
    color: inherit;
66
    font-weight: inherit;
67
    font-size: inherit;
68
    text-decoration: underline;
69
}
70
71
72
div.body
73
{
74
    margin-left: 2em;
75
    margin-right: 2em;
76
}
77
78
th.tablehead
79
{
80
    text-align: left;
81
}
82
83
th.tablehead,
84
td.text_plain
85
{
86 3236 sledge
    padding: 0.375em 0.75em 0;
87 3178 sledge
}
88
89
th.tablehead:first-child,
90
td.text_plain:first-child
91
{
92 3236 sledge
    padding: 0.375em 0.375em 0;
93 3178 sledge
}
94
95
td.text_plain
96
{
97
    vertical-align: top;
98
}
99
100
tr.entry td
101
{
102
    border-bottom: 1px solid #ddd;
103
}
104
105 3236 sledge
tr.entry + tr td
106 3178 sledge
{
107
    border-bottom: 1px solid #066;
108
    padding-top: 0.375em;
109
    padding-bottom: 0.375em;
110
}
111
112 3236 sledge
.dl
113 3178 sledge
{
114 3236 sledge
    background: #eeeeee url(@style-skins-path@/<xsl:value-of select="$qformat"/>/download2.png) 2px center no-repeat;
115 3178 sledge
    border: 1px solid black;
116
    font-weight: bold;
117
    text-decoration: none;
118
    padding: 0.063em 0.375em 0.063em 20px;
119 3236 sledge
    font-size: smaller;
120 3178 sledge
}
121
122
        </style>
123 2950 berkley
      </head>
124
125
      <body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
126 3178 sledge
        <script language="JavaScript">
127
insertTemplateOpening();
128
insertSearchBox();
129
        </script>
130 2950 berkley
131 3178 sledge
        <div class="body">
132 3257 berkley
          <xsl:if test="/resultset/pagesize = 0">
133
            <p class="emphasis">
134
              <xsl:number value="count(resultset/document)" /> components found
135
            </p>
136
          </xsl:if>
137
138 3262 berkley
          <!-- paging code here -->
139 3257 berkley
          <xsl:if test="/resultset/pagesize &gt; 0">
140 3262 berkley
          <table cellspacing="0" cellpadding="0" style="width: 50%;">
141 3257 berkley
          <tr>
142
          <td>
143 3262 berkley
          <xsl:choose>
144
            <xsl:when test="/resultset/previouspage != -1">
145
              <div class="emphasis">
146
                <a style="font-size: smaller;">
147
                          <xsl:attribute name="href">
148
                            <xsl:text>metacat?action=query&amp;operator=INTERSECT&amp;enableediting=false</xsl:text>
149
150
                            <xsl:if test="count(/resultset/query/pathquery/querygroup/queryterm/value) &gt; 0">
151
                              <xsl:text>&amp;anyfield=</xsl:text>
152
                              <xsl:value-of select="/resultset/query/pathquery/querygroup/queryterm/value"/>
153
                            </xsl:if>
154
155
                            <xsl:if test="count(/resultset/query/pathquery/querygroup/queryterm/value) &lt;= 0">
156
                              <xsl:text>&amp;anyfield=%25</xsl:text>
157
                            </xsl:if>
158
159
                            <xsl:text>&amp;qformat=</xsl:text>
160
                            <xsl:value-of select="$qformat"/>
161
162
                            <xsl:text>&amp;sessionid=</xsl:text>
163
                            <xsl:value-of select="$sessid"/>
164
165
                            <xsl:for-each select="/resultset/query/pathquery/returndoctype">
166
                              <xsl:text>&amp;returndoctype=</xsl:text>
167
                              <xsl:value-of select="."/>
168
                            </xsl:for-each>
169
170
                            <xsl:for-each select="/resultset/query/pathquery/returnfield">
171
                              <xsl:text>&amp;returnfield=</xsl:text>
172
                              <xsl:value-of select="."/>
173
                            </xsl:for-each>
174
175
                            <xsl:text>&amp;pagestart=</xsl:text>
176
                            <xsl:value-of select="/resultset/previouspage"/>
177
178
                            <xsl:text>&amp;pagesize=</xsl:text>
179
                            <xsl:value-of select="/resultset/pagesize"/>
180
                          </xsl:attribute>
181
182
                          <xsl:text>Previous Page</xsl:text>
183
                        </a>
184
              </div>
185
            </xsl:when>
186
            <xsl:otherwise>
187
              <div class="emphasis-grey">
188
                Previous Page
189
              </div>
190
            </xsl:otherwise>
191
          </xsl:choose>
192 3257 berkley
          </td>
193 2950 berkley
194 3257 berkley
          <td>
195 3262 berkley
          <xsl:choose>
196
            <xsl:when test="/resultset/lastpage = 'false'">
197
              <div class="emphasis">
198
                <a style="font-size: smaller;">
199
                          <xsl:attribute name="href">
200
                            <xsl:text>metacat?action=query&amp;operator=INTERSECT&amp;enableediting=false</xsl:text>
201
202
                            <xsl:if test="count(/resultset/query/pathquery/querygroup/queryterm/value) &gt; 0">
203
                              <xsl:text>&amp;anyfield=</xsl:text>
204
                              <xsl:value-of select="/resultset/query/pathquery/querygroup/queryterm/value"/>
205
                            </xsl:if>
206
207
                            <xsl:if test="count(/resultset/query/pathquery/querygroup/queryterm/value) &lt;= 0">
208
                              <xsl:text>&amp;anyfield=%25</xsl:text>
209
                            </xsl:if>
210
211
                            <xsl:text>&amp;qformat=</xsl:text>
212
                            <xsl:value-of select="$qformat"/>
213
214
                            <xsl:text>&amp;sessionid=</xsl:text>
215
                            <xsl:value-of select="$sessid"/>
216
217
                            <xsl:for-each select="/resultset/query/pathquery/returndoctype">
218
                              <xsl:text>&amp;returndoctype=</xsl:text>
219
                              <xsl:value-of select="."/>
220
                            </xsl:for-each>
221
222
                            <xsl:for-each select="/resultset/query/pathquery/returnfield">
223
                              <xsl:text>&amp;returnfield=</xsl:text>
224
                              <xsl:value-of select="."/>
225
                            </xsl:for-each>
226
227
                            <xsl:text>&amp;pagestart=</xsl:text>
228
                            <xsl:value-of select="/resultset/nextpage"/>
229
230
                            <xsl:text>&amp;pagesize=</xsl:text>
231
                            <xsl:value-of select="/resultset/pagesize"/>
232
                          </xsl:attribute>
233
234
                          <xsl:text>Next Page</xsl:text>
235
                        </a>
236
              </div>
237
            </xsl:when>
238
            <xsl:otherwise>
239
              <div class="emphasis-grey">
240
                Next Page
241
              </div>
242
            </xsl:otherwise>
243
          </xsl:choose>
244 3257 berkley
          </td>
245
          </tr>
246
          </table>
247
          </xsl:if>
248 3262 berkley
          <!-- end paging code -->
249 3257 berkley
250 3178 sledge
          <!-- This tests to see if there are returned documents,
251
              if there are not then don't show the query results -->
252 2950 berkley
253 3178 sledge
          <xsl:if test="count(resultset/document) &gt; 0">
254
            <table cellspacing="0" cellpadding="0" style="width: 100%;">
255
              <tr>
256
                <th class="tablehead" style="width: 1px;"></th>
257
                <th class="tablehead" style="width: 1px;">Component</th>
258
                <th class="tablehead" style="width: 15em;">Author</th>
259
                <th class="tablehead">Version</th>
260 3236 sledge
                <th class="tablehead"></th>
261 3178 sledge
              </tr>
262 2950 berkley
263 3178 sledge
              <xsl:for-each select="resultset/document">
264
                <xsl:sort select="./param[@name='/entity/@name']"/>
265 3236 sledge
                <xsl:variable name="sq">'</xsl:variable>
266 3178 sledge
                <tr class="entry">
267 2950 berkley
268 3178 sledge
                  <td class="text_plain">
269
                    <xsl:value-of select="position()"/>.
270
                  </td>
271 2950 berkley
272 3178 sledge
                  <td class="text_plain" style="white-space: nowrap;">
273
                    <xsl:if test="./param[@name='entity/@name']!=''">
274 3236 sledge
                      <b style="font-size: larger;">
275 2950 berkley
                        <xsl:value-of select="./param[@name='entity/@name']"/>
276 3178 sledge
                      </b>
277
                    </xsl:if>
278
                  </td>
279 2950 berkley
280 3236 sledge
                  <td class="text_plain">
281
                    <xsl:value-of select="./param[@name=concat('entity/property[@name=', $sq, 'documentation', $sq, ']/property[@name=', $sq, 'author', $sq, ']/configure')]"/>
282 3178 sledge
                  </td>
283 2950 berkley
284 3178 sledge
                  <td class="text_plain">
285 3236 sledge
                    <xsl:value-of select="./param[@name=concat('entity/property[@name=', $sq, 'documentation', $sq, ']/property[@name=', $sq, 'version', $sq, ']/configure')]"/>
286 3178 sledge
                  </td>
287 2950 berkley
288 3236 sledge
                  <td class="text_plain">
289
                    <a class="dl">
290
                      <xsl:attribute name="href">
291
                        <xsl:text>http://@server@/authority/data?lsid=</xsl:text>
292
                        <xsl:value-of select="./param[@name=concat('entity/property[@name=', $sq, 'karId', $sq, ']/@value')]"/>
293
                      </xsl:attribute>
294
295
                      <xsl:text>Download</xsl:text>
296
                    </a>
297
                  </td>
298 3178 sledge
                </tr>
299
300
                <tr>
301
                  <td class="text_plain"></td>
302
                  <td class="text_plain" colspan="6">
303 3236 sledge
                    <xsl:variable name="docClip" select="substring(./param[@name=concat('entity/property[@name=', $sq, 'documentation', $sq, ']/property[@name=', $sq, 'description', $sq, ']/configure')], 0, 200)"/>
304
                    <xsl:value-of select="$docClip"/>
305
                    <xsl:text> </xsl:text>
306
                    <xsl:value-of select="substring(./param[@name=concat('entity/property[@name=', $sq, 'documentation', $sq, ']/property[@name=', $sq, 'userLevelDocumentation', $sq, ']/configure')], 0, 200 - $docClip)"/>
307
                    <xsl:text>... [</xsl:text>
308 3178 sledge
309 3236 sledge
                    <a style="font-size: smaller;">
310 3178 sledge
                      <xsl:attribute name="href">
311
                        <xsl:text>metacat?qformat=</xsl:text>
312
                        <xsl:value-of select="$qformat"/>
313
                        <xsl:text>&amp;sessionid=</xsl:text>
314
                        <xsl:value-of select="$sessid"/>
315
                        <xsl:text>&amp;action=read&amp;docid=</xsl:text>
316
                        <xsl:value-of select="./docid"/>
317
318
                        <xsl:if test="$enableediting = 'true'">
319
                          <xsl:text>&amp;enableediting=</xsl:text>
320
                          <xsl:value-of select="$enableediting"/>
321
                        </xsl:if>
322
                      </xsl:attribute>
323
324 3180 sledge
                      <xsl:text>View Documentation</xsl:text>
325 3178 sledge
                    </a>
326
327 3236 sledge
                    <xsl:text>]</xsl:text>
328 3178 sledge
                  </td>
329
                </tr>
330
              </xsl:for-each>
331
            </table>
332
          </xsl:if>
333
        </div>
334
        <script language="JavaScript">
335
insertTemplateClosing();
336
        </script>
337
      </body>
338 2950 berkley
    </html>
339 3178 sledge
  </xsl:template>
340
</xsl:stylesheet>