Project

General

Profile

1
<?xml version="1.0"?>
2
<!--
3
  *  '$RCSfile: eml-protocol-2.0.0.xsl,v $'
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: cjones $'
10
  *     '$Date: 2004/10/05 23:50:34 $'
11
  * '$Revision: 1.1 $'
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="iso-8859-1"
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
<!-- Here, protocol is more/less synonomous with ProcedureStepType, which is most of
41
what composes methodStep -->
42
  <xsl:template name="protocol">
43
    <xsl:param name="protocolfirstColStyle"/>
44
    <xsl:param name="protocolsubHeaderStyle"/>
45
   <table class="{$tabledefaultStyle}">
46
        <xsl:choose>
47
         <xsl:when test="references!=''">
48
          <xsl:variable name="ref_id" select="references"/>
49
          <xsl:variable name="references" select="$ids[@id=$ref_id]" />
50
          <xsl:for-each select="$references">
51
            <xsl:call-template name="protocolcommon">
52
              <xsl:with-param name="protocolfirstColStyle" select="$protocolfirstColStyle"/>
53
              <xsl:with-param name="protocolsubHeaderStyle" select="$protocolsubHeaderStyle"/>
54
            </xsl:call-template>
55
          </xsl:for-each>
56
        </xsl:when>
57
        <xsl:otherwise>
58
           <xsl:call-template name="protocolcommon">
59
              <xsl:with-param name="protocolfirstColStyle" select="$protocolfirstColStyle"/>
60
              <xsl:with-param name="protocolsubHeaderStyle" select="$protocolsubHeaderStyle"/>
61
           </xsl:call-template>
62
        </xsl:otherwise>
63
      </xsl:choose>
64
     </table>
65
  </xsl:template>
66

    
67
   <xsl:template name="protocolcommon">
68
        <xsl:param name="protocolfirstColStyle"/>
69
        <xsl:param name="protocolsubHeaderStyle"/>
70
        
71
	<!-- template for protocol shows minimum elements (author, title, dist) -->
72
       <xsl:call-template name="protocol_simple">
73
           <xsl:with-param name="protocolfirstColStyle" select="$protocolfirstColStyle"/>
74
           <xsl:with-param name="protocolsubHeaderStyle" select="$protocolsubHeaderStyle"/>
75
        </xsl:call-template>
76

    
77
        <xsl:for-each select="proceduralStep">
78
          <tr><td colspan="2" class="{$protocolsubHeaderStyle}">
79
              Step<xsl:text> </xsl:text><xsl:value-of select="position()"/>:
80
              </td>
81
          </tr>
82
          <xsl:call-template name="step">
83
              <xsl:with-param name="protocolfirstColStyle" select="$protocolfirstColStyle"/>
84
              <xsl:with-param name="protocolsubHeaderStyle" select="$protocolsubHeaderStyle"/>
85
          </xsl:call-template>
86
        </xsl:for-each>  
87
			
88
        <xsl:call-template name="protocolAccess">
89
              <xsl:with-param name="protocolfirstColStyle" select="$protocolfirstColStyle"/>
90
              <xsl:with-param name="protocolsubHeaderStyle" select="$protocolsubHeaderStyle"/>
91
        </xsl:call-template>
92
  </xsl:template>
93

    
94
<!-- this template creates a small table for a protocol tree with minimum required 
95
content (title/creator/distribution). Only called in this stylesheet. It would be
96
better to reuse the resource templates? but those currently are written for 
97
toplevel, and that style is too prominent for this location. use modes? 
98
but all calls to resource templates would be affected.
99
-->
100
	<xsl:template name="protocol_simple">
101
	  <xsl:param name="protocolfirstColStyle"/>
102
		<xsl:param name="protocolsubHeaderStyle"/>
103
	<!--	<table class="{$tabledefaultStyle}">  -->
104
		
105
		<xsl:for-each select="creator/individualName/surName">
106
      <tr>	
107
				<td class="{$protocolfirstColStyle}">
108
				<xsl:text>Author: </xsl:text>
109
				</td>
110
				<td><xsl:value-of select="."/>
111
				</td>
112
      </tr>
113
	</xsl:for-each>
114
   
115
    <xsl:for-each select="title">
116
      <tr>
117
        <td class="{$protocolfirstColStyle}">
118
        <xsl:text>Title: </xsl:text>
119
        </td>
120
        <td><xsl:value-of select="."/>
121
        </td>
122
      </tr>
123
  </xsl:for-each>
124
 
125
  <xsl:for-each select="distribution">
126
      <!--<tr>
127
        <td>
128
         the template 'distribution' in eml-distribution.2.0.0.xsl. seems to be for
129
				data tables. use the resourcedistribution template instead (eml-resource.2.0.0.xsl)  -->
130
            <xsl:call-template name="resourcedistribution">
131
              <xsl:with-param name="resfirstColStyle" select="$protocolfirstColStyle"/>
132
              <xsl:with-param name="ressubHeaderStyle" select="$protocolsubHeaderStyle"/> 
133
					  </xsl:call-template>
134
			 <!-- </td>
135
      </tr>  -->
136
  </xsl:for-each>
137
  <!-- </table> -->
138
	</xsl:template>
139

    
140

    
141

    
142
  <!-- 'step' refers to ProcedureStepType, ie, methodStep (w/o optional dataSource)
143
	(called from method.xsl, and here, from nested subStep)
144
	mob added the table element to box each step 
145
	-->
146
  <xsl:template name="step">
147
    <xsl:param name="protocolfirstColStyle"/>
148
    <xsl:param name="protocolsubHeaderStyle"/>
149
				
150
		<table class="{$tabledefaultStyle}">
151

    
152
    <xsl:for-each select="description">
153
		
154
		
155
      <tr><td class="{$protocolfirstColStyle}">
156
          Description:
157
          </td>
158
          <td>
159
             <xsl:call-template name="text">
160
               <xsl:with-param name="textfirstColStyle" select="$protocolfirstColStyle"/>
161
             </xsl:call-template>
162
          </td>
163
      </tr>
164
     </xsl:for-each>
165

    
166
    <xsl:for-each select="citation">
167
      <tr><td class="{$protocolfirstColStyle}">
168
          Citation:
169
          </td>
170
          <td class="{$secondColStyle}">
171
           &#160;
172
          </td>
173
      </tr>
174
      <tr><td colspan="2">
175
          <xsl:call-template name="citation">
176
            <xsl:with-param name="citationfirstColStyle" select="$protocolfirstColStyle"/>
177
            <xsl:with-param name="citationsubHeaderStyle" select="$protocolsubHeaderStyle"/>
178
          </xsl:call-template>
179
          </td>
180
      </tr>
181
    </xsl:for-each>
182

    
183
     <xsl:for-each select="protocol">
184
      <tr><td class="{$protocolfirstColStyle}">
185
          Protocol:
186
          </td>
187
          <td class="{$secondColStyle}">    
188
					<!-- mob nested this table in col2, instead of new row. -->
189
	       <xsl:call-template name="protocol">
190
            <xsl:with-param name="protocolfirstColStyle" select="$protocolfirstColStyle"/>
191
            <xsl:with-param name="protocolsubHeaderStyle" select="$protocolsubHeaderStyle"/>
192
          </xsl:call-template>
193
          </td>
194
	      </tr>
195
      
196
    </xsl:for-each>
197
    <xsl:for-each select="instrumentation">
198
        <tr><td class="{$protocolfirstColStyle}">
199
          Instrument(s):
200
          </td>
201
          <td class="{$secondColStyle}">
202
            <xsl:value-of select="."/>
203
          </td>
204
        </tr>
205
            
206
    </xsl:for-each>
207
		
208
    <xsl:for-each select="software">
209
     <tr><td colspan="2">
210
          <xsl:call-template name="software">
211
            <xsl:with-param name="softwarefirstColStyle" select="$protocolfirstColStyle"/>
212
            <xsl:with-param name="softwaresubHeaderStyle" select="$protocolsubHeaderStyle"/>
213
          </xsl:call-template>
214
          </td>
215
      </tr>
216
			
217
    </xsl:for-each>
218
    <xsl:for-each select="subStep">
219
      <tr><td class="{$protocolfirstColStyle}">
220
          Substep<xsl:text> </xsl:text><xsl:value-of select="position()"/>
221
          </td>
222
          <td class="{$secondColStyle}">
223
           &#160;
224
          </td>
225
					<td>  <!-- correct? was outside of table -->
226
						<xsl:call-template name="step">
227
						<xsl:with-param name="protocolfirstColStyle" select="$protocolfirstColStyle"/>
228
						<xsl:with-param name="protocolsubHeaderStyle" select="$protocolsubHeaderStyle"/>
229
						</xsl:call-template>
230
					</td>
231
		  </tr>						
232
    </xsl:for-each>
233
	
234
		</table>  <!-- matches table at start of step -->
235
		
236
  </xsl:template> 
237
	<!-- end of template name="step" -->
238

    
239
	
240
	<!-- ? needed? no access elements here. -->
241
  <xsl:template name="protocolAccess">
242
    <xsl:param name="protocolfirstColStyle"/>
243
    <xsl:param name="protocolsubHeaderStyle"/>
244
    <xsl:for-each select="access">
245
      <tr><td colspan="2">
246
         <xsl:call-template name="access">
247
           <xsl:with-param name="accessfirstColStyle" select="$protocolfirstColStyle"/>
248
           <xsl:with-param name="accesssubHeaderStyle" select="$protocolsubHeaderStyle"/>
249
         </xsl:call-template>
250
         </td>
251
       </tr>
252
    </xsl:for-each>
253
  </xsl:template>
254
</xsl:stylesheet>
(21-21/31)