Project

General

Profile

1
<?xml version="1.0"?>
2
<!--
3
  *  '$RCSfile$'
4
  *      Authors: Matthew Brooke
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: 2013-07-16 13:17:24 -0700 (Tue, 16 Jul 2013) $'
11
  * '$Revision: 8005 $'
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 that is valid with respect to the eml-variable.dtd
29
  * module of the Ecological Metadata Language (EML) into an HTML format
30
  * suitable for rendering with modern web browsers.
31
-->
32
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
33

    
34
  <xsl:output method="html" encoding="UTF-8"
35
              doctype-public="-//W3C//DTD HTML 4.01 Transitional//EN"
36
              doctype-system="http://www.w3.org/TR/html4/loose.dtd"
37
              indent="yes" />  
38

    
39

    
40

    
41
  <xsl:template name="protocol">
42
    <xsl:param name="protocolfirstColStyle"/>
43
    <xsl:param name="protocolsubHeaderStyle"/>
44
    <table class="{$tabledefaultStyle}">
45
        <xsl:choose>
46
         <xsl:when test="references!=''">
47
          <xsl:variable name="ref_id" select="references"/>
48
          <xsl:variable name="references" select="$ids[@id=$ref_id]" />
49
          <xsl:for-each select="$references">
50
            <xsl:call-template name="protocolcommon">
51
              <xsl:with-param name="protocolfirstColStyle" select="$protocolfirstColStyle"/>
52
              <xsl:with-param name="protocolsubHeaderStyle" select="$protocolsubHeaderStyle"/>
53
            </xsl:call-template>
54
          </xsl:for-each>
55
        </xsl:when>
56
        <xsl:otherwise>
57
           <xsl:call-template name="protocolcommon">
58
              <xsl:with-param name="protocolfirstColStyle" select="$protocolfirstColStyle"/>
59
              <xsl:with-param name="protocolsubHeaderStyle" select="$protocolsubHeaderStyle"/>
60
           </xsl:call-template>
61
        </xsl:otherwise>
62
      </xsl:choose>
63
    </table>
64
  </xsl:template>
65

    
66
   <xsl:template name="protocolcommon">
67
        <xsl:param name="protocolfirstColStyle"/>
68
        <xsl:param name="protocolsubHeaderStyle"/>
69
        
70
        <!-- template for protocol shows minimum elements (author, title, dist) -->
71
		<xsl:call-template name="protocol_simple">
72
           <xsl:with-param name="protocolfirstColStyle" select="$protocolfirstColStyle"/>
73
           <xsl:with-param name="protocolsubHeaderStyle" select="$protocolsubHeaderStyle"/>
74
        </xsl:call-template>
75
        <xsl:for-each select="proceduralStep">
76
          <tr><td colspan="2" class="{$protocolsubHeaderStyle}">
77
              Step<xsl:text> </xsl:text><xsl:value-of select="position()"/>:
78
              </td>
79
          </tr>
80
          <xsl:call-template name="step">
81
              <xsl:with-param name="protocolfirstColStyle" select="$protocolfirstColStyle"/>
82
              <xsl:with-param name="protocolsubHeaderStyle" select="$protocolsubHeaderStyle"/>
83
          </xsl:call-template>
84
        </xsl:for-each>
85
        <xsl:call-template name="protocolAccess">
86
              <xsl:with-param name="protocolfirstColStyle" select="$protocolfirstColStyle"/>
87
              <xsl:with-param name="protocolsubHeaderStyle" select="$protocolsubHeaderStyle"/>
88
        </xsl:call-template>
89
  </xsl:template>
90

    
91
  <xsl:template name="step">
92
    <xsl:param name="protocolfirstColStyle"/>
93
    <xsl:param name="protocolsubHeaderStyle"/>
94
    <xsl:for-each select="description">
95
		<div class="control-group">
96
			<label class="control-label">Description</label>
97
			<div class="controls">
98
				<xsl:call-template name="text">
99
					<xsl:with-param name="textfirstColStyle" select="$protocolfirstColStyle"/>
100
				</xsl:call-template>
101
			</div>
102
      </div>
103
     </xsl:for-each>
104
    <xsl:for-each select="citation">
105
      <div class="control-group">
106
		<label class="control-label">Citation</label>
107
		<div class="controls">
108
          <xsl:call-template name="citation">
109
            <xsl:with-param name="citationfirstColStyle" select="$protocolfirstColStyle"/>
110
            <xsl:with-param name="citationsubHeaderStyle" select="$protocolsubHeaderStyle"/>
111
          </xsl:call-template>
112
        </div>
113
      </div>
114
    </xsl:for-each>
115
     <xsl:for-each select="protocol">
116
      <div class="control-group">
117
		<label class="control-label">Protocol</label>
118
		<div class="controls">
119
			<xsl:call-template name="protocol">
120
	            <xsl:with-param name="protocolfirstColStyle" select="$protocolfirstColStyle"/>
121
	            <xsl:with-param name="protocolsubHeaderStyle" select="$protocolsubHeaderStyle"/>
122
 			</xsl:call-template>
123
          </div>
124
      </div>
125
    </xsl:for-each>
126
    <xsl:for-each select="instrumentation">
127
        <div class="control-group">
128
			<label class="control-label">Instrument(s)</label>
129
          <div class="controls">
130
            <xsl:value-of select="."/>
131
          </div>
132
      </div>
133
    </xsl:for-each>
134
    <xsl:for-each select="software">
135
     <div class="control-group">
136
		<label class="control-label"></label>
137
		<div>	
138
          <xsl:call-template name="software">
139
            <xsl:with-param name="softwarefirstColStyle" select="$protocolfirstColStyle"/>
140
            <xsl:with-param name="softwaresubHeaderStyle" select="$protocolsubHeaderStyle"/>
141
          </xsl:call-template>
142
        </div>
143
      </div>
144
    </xsl:for-each>
145
    <xsl:for-each select="subStep">
146
		<div class="control-group">
147
			<label class="control-label">Substep<xsl:text> </xsl:text><xsl:value-of select="position()"/></label>
148
			<div class="controls">
149
			      <xsl:call-template name="step">
150
			          <xsl:with-param name="protocolfirstColStyle" select="$protocolfirstColStyle"/>
151
			          <xsl:with-param name="protocolsubHeaderStyle" select="$protocolsubHeaderStyle"/>
152
			      </xsl:call-template>
153
			</div>
154
		</div> 
155
    </xsl:for-each>
156
  </xsl:template>
157

    
158
  <xsl:template name="protocolAccess">
159
    <xsl:param name="protocolfirstColStyle"/>
160
    <xsl:param name="protocolsubHeaderStyle"/>
161
    <xsl:for-each select="access">
162
      <tr><td colspan="2">
163
         <xsl:call-template name="access">
164
           <xsl:with-param name="accessfirstColStyle" select="$protocolfirstColStyle"/>
165
           <xsl:with-param name="accesssubHeaderStyle" select="$protocolsubHeaderStyle"/>
166
         </xsl:call-template>
167
         </td>
168
       </tr>
169
    </xsl:for-each>
170
  </xsl:template>
171
  
172
  <!-- this template creates a small table for a protocol tree with minimum required 
173
	content (title/creator/distribution). Only called in this stylesheet. It would be
174
	better to reuse the resource templates? but those currently are written for 
175
	toplevel, and that style is too prominent for this location. use modes? 
176
	but all calls to resource templates would be affected.
177
	-->
178
	<xsl:template name="protocol_simple">
179
		<xsl:param name="protocolfirstColStyle"/>
180
		<xsl:param name="protocolsubHeaderStyle"/>
181
		<!--<table class="{$tabledefaultStyle}">  -->
182
		
183
		<xsl:for-each select="creator/individualName/surName">
184
			<tr>	
185
				<td class="{$protocolfirstColStyle}">
186
				<xsl:text>Author: </xsl:text>
187
				</td>
188
				<td><xsl:value-of select="."/>
189
				</td>
190
			</tr>
191
		</xsl:for-each>
192
   
193
		<xsl:for-each select="title">
194
			<tr>
195
			  <td class="{$protocolfirstColStyle}">
196
			  <xsl:text>Title: </xsl:text>
197
			  </td>
198
			  <td><xsl:value-of select="."/>
199
			  </td>
200
			</tr>
201
		</xsl:for-each>
202
 
203
	<xsl:for-each select="distribution">
204
      <!--<tr>
205
        <td>
206
         the template 'distribution' in eml-distribution.2.0.0.xsl. seems to be for
207
				data tables. use the resourcedistribution template instead (eml-resource.2.0.0.xsl)  -->
208
            <xsl:call-template name="resourcedistribution">
209
              <xsl:with-param name="resfirstColStyle" select="$protocolfirstColStyle"/>
210
              <xsl:with-param name="ressubHeaderStyle" select="$protocolsubHeaderStyle"/> 
211
			</xsl:call-template>
212
		<!-- </td>
213
		</tr>  -->
214
		</xsl:for-each>
215
		<!-- </table> -->
216
	</xsl:template>
217
	
218
</xsl:stylesheet>
(18-18/27)