Project

General

Profile

1
<?xml version="1.0"?> 
2
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
3

    
4
  <xsl:template match="/">
5
    <table width="100%">
6
      <tr>
7
        <th>
8
          Document ID
9
        </th>
10
        <th>
11
          &#160;
12
        </th>
13
        <th>
14
          Title
15
        </th>
16
        <th>
17
          Document Type
18
        </th>
19
      </tr>
20
      <xsl:apply-templates select="//document"/>
21
    </table>
22
    
23
    <!-- page navigation-->
24
    <div class="resultnavbar">
25
      <!--previous-->
26
      <xsl:choose>
27
        <xsl:when test="//pagestart = 0">
28
          &#8592; previous
29
        </xsl:when>
30
        <xsl:otherwise>
31
          <a>
32
            <xsl:attribute name="href">
33
              <xsl:if test="/resultset/query/pathquery/querygroup/queryterm/value!='%'">
34
                javascript:reloadSearchContent('/sms/metacat?action=query&amp;anyfield=<xsl:value-of select="/resultset/query/pathquery/querygroup/queryterm/value"/>&amp;qformat=sms&amp;returnfield=dataset/title&amp;pagesize=10&amp;pagestart=<xsl:value-of select="//previouspage"/>');
35
              </xsl:if>
36
              <xsl:if test="/resultset/query/pathquery/querygroup/queryterm/value='%'">
37
                javascript:reloadSearchContent('/sms/metacat?action=query&amp;anyfield=<xsl:value-of select="'%25'"/><xsl:value-of select="'25'"/>&amp;qformat=sms&amp;returnfield=dataset/title&amp;pagesize=10&amp;pagestart=<xsl:value-of select="//previouspage"/>');
38
              </xsl:if>
39
            </xsl:attribute>
40
              &#8592; previous
41
          </a>
42
        </xsl:otherwise>
43
      </xsl:choose>
44
            
45
      &#160; &#160; 
46
      
47
      <!--next-->
48
      <xsl:choose>
49
        <xsl:when test="//lastpage = 'true'">
50
          next &#8594;
51
        </xsl:when>
52
        <xsl:otherwise>
53
          <a>
54
          <xsl:attribute name="href">
55
            <xsl:choose>
56
            <xsl:when test="/resultset/query/pathquery/querygroup/queryterm/value!='%'">
57
              javascript:reloadSearchContent('/sms/metacat?action=query&amp;anyfield=<xsl:value-of select="/resultset/query/pathquery/querygroup/queryterm/value"/>&amp;qformat=sms&amp;returnfield=dataset/title&amp;pagesize=10&amp;pagestart=<xsl:value-of select="//nextpage"/>');
58
            </xsl:when>
59
            <xsl:when test="/resultset/query/pathquery/querygroup/queryterm/value='%'">
60
              javascript:reloadSearchContent('/sms/metacat?action=query&amp;anyfield=<xsl:value-of select="'%25'"/><xsl:value-of select="'25'"/>&amp;qformat=sms&amp;returnfield=dataset/title&amp;pagesize=10&amp;pagestart=<xsl:value-of select="//nextpage"/>');
61
            </xsl:when>
62
            </xsl:choose>
63
           
64
          </xsl:attribute>
65
            next &#8594;
66
          </a>
67
        </xsl:otherwise>
68
      </xsl:choose>
69
    </div>
70
  </xsl:template>
71
  
72
  <!--search results-->
73
  <xsl:template match="document">
74
    <tr>
75
      <td>
76
        <a><!--docid-->
77
        <xsl:attribute name="href">
78
          /sms/metacat?action=read&amp;qformat=sms&amp;docid=<xsl:value-of select="docid"/>
79
        </xsl:attribute>
80
        <xsl:value-of select="docid"/>
81
        </a>
82
      </td>
83
      <td><!--xml link-->
84
        <a>
85
          <xsl:attribute name="href">
86
            /sms/metacat?action=read&amp;qformat=xml&amp;docid=<xsl:value-of select="docid"/>
87
          </xsl:attribute>
88
          <img width="25px" src="style/skins/sms/xml-button.png"/>
89
        </a>
90
      </td>
91
      <td> <!--title of the doc if it's eml-->
92
        <xsl:choose>
93
          <xsl:when test="param[@name='dataset/title'] != ''">
94
            <xsl:value-of select="param[@name='dataset/title']"/>
95
          </xsl:when>
96
          <xsl:otherwise>
97
            No Title
98
          </xsl:otherwise>
99
        </xsl:choose>
100
      </td>
101
      <td><!--doc type-->
102
        <xsl:choose>
103
        <xsl:when test="doctype='eml://ecoinformatics.org/eml-2.0.1'">
104
          EML 2.0.1 Document
105
        </xsl:when>
106
        <xsl:when test="doctype='rdf:RDF'">
107
          RDF Ontology
108
        </xsl:when>
109
        <xsl:when test="doctype='http://daks.ucdavis.edu/sms-annot-1.0.0rc1'">
110
          SMS Annotation
111
        </xsl:when>
112
        <!--add more doctypes here-->
113
        <xsl:otherwise>
114
          <xsl:value-of select="doctype"/>
115
        </xsl:otherwise>
116
        </xsl:choose>
117
      </td>
118
    </tr>
119
  </xsl:template>
120
  
121
  
122
  
123

    
124
</xsl:stylesheet>
(9-9/23)