Project

General

Profile

1 51 jones
<?xml version="1.0"?>
2
<!--
3
  * resultset.xsl
4
  *
5
  *      Authors: Matt Jones
6
  *    Copyright: 2000 Regents of the University of California and the
7
  *               National Center for Ecological Analysis and Synthesis
8
  *  For Details: http://www.nceas.ucsb.edu/
9
  *      Created: 2000 April 5
10
  *    File Info: '$Id$'
11
  *
12
  * This is an XSLT (http://www.w3.org/TR/xslt) stylesheet designed to
13
  * convert an XML file showing the resultset of a query
14
  * into an HTML format suitable for rendering with modern web browsers.
15
-->
16
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
17
18
  <xsl:output method="html"/>
19
20
  <xsl:template match="/">
21
    <html>
22
      <head>
23 329 jones
	<link rel="stylesheet" type="text/css" href="/xmltodb/rowcol.css" />
24 51 jones
      </head>
25
      <body class="emlbody">
26
	<center>
27 105 jones
          <b>Query Results</b>
28
          for query <xsl:value-of select="resultset/query"/>
29 51 jones
        </center>
30
31 329 jones
        <form action="/xmltodb/servlet/metacat" method="POST">
32 85 jones
        <input type="hidden" name="action" value="getdocument"/>
33
34
        <xsl:text>Output Format: </xsl:text>
35
        <select name="qformat">
36
          <option value="html">HTML</option>
37
          <option value="xml">XML</option>
38
        </select>
39
40 51 jones
        <table width="100%">
41
        <tr class="rowodd">
42 85 jones
        <th>&nbsp;</th>
43 101 jones
        <th><xsl:text>Title</xsl:text></th>
44 98 jones
        <th><xsl:text>Document</xsl:text></th>
45
        <th><xsl:text>Document Type</xsl:text></th>
46 51 jones
        </tr>
47
48 98 jones
        <xsl:for-each select="resultset/document">
49 51 jones
          <tr valign="top">
50
            <xsl:attribute name="class">
51
              <xsl:choose>
52
                <xsl:when test="position() mod 2 = 1">rowwhite</xsl:when>
53
                <xsl:when test="position() mod 2 = 0">rowlight</xsl:when>
54
              </xsl:choose>
55
            </xsl:attribute>
56
57 85 jones
          <td>
58 103 jones
<!--
59 85 jones
              <input type="radio" name="docid">
60
                <xsl:attribute name="value">
61 98 jones
                  <xsl:value-of select="./docid"/>
62 85 jones
                </xsl:attribute>
63
              </input>
64
              <input type="submit" value="Display"/>
65 103 jones
-->
66
              <input border="0" type="image">
67
                <xsl:attribute name="src">
68
                  <xsl:choose>
69
                    <xsl:when test="position()
70 329 jones
                         mod 2 = 1">/xmltodb/bttns-white.png</xsl:when>
71 103 jones
                    <xsl:when test="position()
72 329 jones
                         mod 2 = 0">/xmltodb/bttns-blue.jpg</xsl:when>
73 103 jones
                  </xsl:choose>
74
                </xsl:attribute>
75
                <xsl:attribute name="name">
76 102 jones
                  <xsl:value-of select="./docid"/>
77
                </xsl:attribute>
78
              </input>
79 51 jones
          </td>
80 101 jones
          <td><xsl:value-of select="./doctitle"/>
81
              <xsl:text>&nbsp;</xsl:text>
82
         </td>
83 85 jones
          <td>
84 98 jones
              <xsl:value-of select="./docname"/>
85
              <xsl:text> </xsl:text>
86
              <xsl:value-of select="./docid"/>
87 101 jones
              <xsl:text>&nbsp;</xsl:text>
88 85 jones
          </td>
89 101 jones
          <td><xsl:value-of select="./doctype"/>
90
              <xsl:text>&nbsp;</xsl:text>
91
         </td>
92 51 jones
          </tr>
93
        </xsl:for-each>
94
        </table>
95 85 jones
        </form>
96 51 jones
97
      </body>
98
    </html>
99
  </xsl:template>
100
101
</xsl:stylesheet>