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