Project

General

Profile

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-06-17 13:16:32 -0700 (Tue, 17 Jun 2008) $'
11
* '$Revision: 4006 $'
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
32
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
33
    xmlns="http://www.w3.org/1999/xhtml"
34
    version="1.0">
35

    
36
  <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
  <xsl:param name="sessid"/>
42
  <xsl:param name="qformat">default</xsl:param>
43
  <xsl:param name="enableediting">false</xsl:param>
44
  <xsl:param name="contextURL"/>
45
  <xsl:param name="httpServer"/>
46
  
47

    
48
  <xsl:template match="/">
49
    <html xml:lang="en-US">
50
      <head>
51
        <title>Components Search Results</title>
52
        <link rel="stylesheet" type="text/css"
53
            href="{$contextURL}/style/skins/{$qformat}/{$qformat}.css" />
54
        <script language="Javascript" type="text/JavaScript"
55
            src="{$contextURL}/style/skins/{$qformat}/{$qformat}.js">
56
          <xsl:text disable-output-escaping="yes">
57
          </xsl:text>
58
        </script>
59
        <script language="Javascript" type="text/JavaScript"
60
            src="{$contextURL}/style/common/branding.js">
61
          <xsl:text disable-output-escaping="yes">
62
          </xsl:text>
63
        </script>
64
        <style type="text/css">
65

    
66
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
    padding: 0.375em 0.75em 0;
90
}
91

    
92
th.tablehead:first-child,
93
td.text_plain:first-child
94
{
95
    padding: 0.375em 0.375em 0;
96
}
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
tr.entry + tr td
109
{
110
    border-bottom: 1px solid #066;
111
    padding-top: 0.375em;
112
    padding-bottom: 0.375em;
113
}
114

    
115
.dl
116
{
117
    background: #eeeeee url(<xsl:value-of select="contextURL"/>/style/skins/<xsl:value-of select="$qformat"/>/download2.png) 2px center no-repeat;
118
    border: 1px solid black;
119
    font-weight: bold;
120
    text-decoration: none;
121
    padding: 0.063em 0.375em 0.063em 20px;
122
    font-size: smaller;
123
}
124

    
125
        </style>
126
      </head>
127

    
128
      <body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
129
        <script language="JavaScript">
130
          <![CDATA[
131
          insertTemplateOpening("]]><xsl:value-of select="$contextURL" /><![CDATA[");
132
          insertSearchBox("]]><xsl:value-of select="$contextURL" /><![CDATA[");
133
         ]]>
134
        </script>
135

    
136
        <div class="body">
137
          <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
          <!-- paging code here -->
144
          <xsl:if test="/resultset/pagesize &gt; 0">
145
          <table cellspacing="0" cellpadding="0" style="width: 50%;">
146
          <tr>
147
          <td>
148
          <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
          </td>
198

    
199
          <td>
200
          <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
          </td>
250
          </tr>
251
          </table>
252
          </xsl:if>
253
          <!-- end paging code -->
254
          
255
          <!-- This tests to see if there are returned documents,
256
              if there are not then don't show the query results -->
257

    
258
          <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
                <th class="tablehead"></th>
266
              </tr>
267

    
268
              <xsl:for-each select="resultset/document">
269
                <xsl:sort select="./param[@name='/entity/@name']"/>
270
                <xsl:variable name="sq">'</xsl:variable>
271
                <tr class="entry">
272

    
273
                  <td class="text_plain">
274
                    <xsl:value-of select="position()"/>.
275
                  </td>
276

    
277
                  <td class="text_plain" style="white-space: nowrap;">
278
                    <xsl:if test="./param[@name='entity/@name']!=''">
279
                      <b style="font-size: larger;">
280
                        <xsl:value-of select="./param[@name='entity/@name']"/>
281
                      </b>
282
                    </xsl:if>
283
                  </td>
284

    
285
                  <td class="text_plain">
286
                    <xsl:value-of select="./param[@name=concat('entity/property[@name=', $sq, 'KeplerDocumentation', $sq, ']/property[@name=', $sq, 'author', $sq, ']/configure')]"/>
287
                  </td>
288

    
289
                  <td class="text_plain">
290
                    <xsl:value-of select="./param[@name=concat('entity/property[@name=', $sq, 'KeplerDocumentation', $sq, ']/property[@name=', $sq, 'version', $sq, ']/configure')]"/>
291
                  </td>
292

    
293
                  <td class="text_plain">
294
                    <a class="dl">
295
                      <xsl:attribute name="href">
296
                        <xsl:value-of select="$httpServer"/><xsl:text>/authority/data?lsid=</xsl:text>
297
                        <xsl:value-of select="./param[@name=concat('entity/property[@name=', $sq, 'karId', $sq, ']/@value')]"/>
298
                      </xsl:attribute>
299

    
300
                      <xsl:text>Download</xsl:text>
301
                    </a>
302
                  </td>
303
                </tr>
304

    
305
                <tr>
306
                  <td class="text_plain"></td>
307
                  <td class="text_plain" colspan="6">
308
                    <xsl:variable name="docClip" select="substring(./param[@name=concat('entity/property[@name=', $sq, 'KeplerDocumentation', $sq, ']/property[@name=', $sq, 'userLevelDocumentation', $sq, ']/configure')], 0, 200)"/>
309
                    <xsl:value-of select="$docClip"/>
310
                    <xsl:text> </xsl:text>
311
                    <!-- <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
                    <xsl:text>... [</xsl:text>
321

    
322
                    <a style="font-size: smaller;">
323
                      <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
                      <xsl:text>View Documentation</xsl:text>
338
                    </a>
339

    
340
                    <xsl:text>]</xsl:text>
341
                  </td>
342
                </tr>
343
              </xsl:for-each>
344
            </table>
345
          </xsl:if>
346
        </div>
347
        <script language="JavaScript">
348
          <![CDATA[
349
          insertTemplateClosing("]]><xsl:value-of select="$contextURL" /><![CDATA[");
350
         ]]>
351
        </script>
352
      </body>
353
    </html>
354
  </xsl:template>
355
</xsl:stylesheet>
356

    
(13-13/14)