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: tao $'
10
  *     '$Date: 2003-07-17 17:48:51 -0700 (Thu, 17 Jul 2003) $'
11
  * '$Revision: 1735 $'
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
  <xsl:import href="eml-text-2.0.0.xsl" />
34
  <xsl:output method="html" encoding="iso-8859-1"/>
35

    
36

    
37
<!-- This module is for distribution and it is self-contained-->
38

    
39
  <xsl:template name="distribution">
40
      <xsl:param name="disfirstColStyle"/>
41
      <xsl:param name="dissubHeaderStyle"/>
42
      <xsl:param name="docid"/>
43
      <xsl:param name="level">entitylevel</xsl:param>
44
      <xsl:param name="entitytype"/>
45
      <xsl:param name="entityindex"/>
46
      <xsl:param name="physicalindex"/>
47
      <xsl:param name="distributionindex"/>
48
      <table xsl:use-attribute-sets="cellspacing" class="tabledefault" width="100%">
49
       <xsl:choose>
50
         <xsl:when test="references!=''">
51
          <xsl:variable name="ref_id" select="references"/>
52
          <xsl:variable name="references" select="$ids[@id=$ref_id]" />
53
          <xsl:for-each select="$references">
54
            <xsl:apply-templates select="online">
55
              <xsl:with-param name="dissubHeaderStyle" select="$dissubHeaderStyle"/>
56
              <xsl:with-param name="disfirstColStyle" select="$disfirstColStyle" />
57
            </xsl:apply-templates>
58
            <xsl:apply-templates select="offline">
59
              <xsl:with-param name="dissubHeaderStyle" select="$dissubHeaderStyle"/>
60
              <xsl:with-param name="disfirstColStyle" select="$disfirstColStyle" />
61
            </xsl:apply-templates>
62
            <xsl:apply-templates select="inline">
63
              <xsl:with-param name="dissubHeaderStyle" select="$dissubHeaderStyle"/>
64
              <xsl:with-param name="disfirstColStyle" select="$disfirstColStyle" />
65
               <xsl:with-param name="docid" select="$docid"/>
66
               <xsl:with-param name="level" select="$level"/>
67
               <xsl:with-param name="entitytype" select="$entitytype"/>
68
               <xsl:with-param name="entityindex" select="$entityindex"/>
69
               <xsl:with-param name="physicalindex" select="$physicalindex"/>
70
               <xsl:with-param name="distributionindex" select="$distributionindex"/>
71
             </xsl:apply-templates>
72
          </xsl:for-each>
73
        </xsl:when>
74
        <xsl:otherwise>
75
            <xsl:apply-templates select="online">
76
              <xsl:with-param name="dissubHeaderStyle" select="$dissubHeaderStyle"/>
77
              <xsl:with-param name="disfirstColStyle" select="$disfirstColStyle" />
78
            </xsl:apply-templates>
79
            <xsl:apply-templates select="offline">
80
              <xsl:with-param name="dissubHeaderStyle" select="$dissubHeaderStyle"/>
81
              <xsl:with-param name="disfirstColStyle" select="$disfirstColStyle" />
82
            </xsl:apply-templates>
83
            <xsl:apply-templates select="inline">
84
              <xsl:with-param name="dissubHeaderStyle" select="$dissubHeaderStyle"/>
85
              <xsl:with-param name="disfirstColStyle" select="$disfirstColStyle" />
86
               <xsl:with-param name="docid" select="$docid"/>
87
               <xsl:with-param name="level" select="$level"/>
88
               <xsl:with-param name="entitytype" select="$entitytype"/>
89
               <xsl:with-param name="entityindex" select="$entityindex"/>
90
               <xsl:with-param name="physicalindex" select="$physicalindex"/>
91
               <xsl:with-param name="distributionindex" select="$distributionindex"/>
92
            </xsl:apply-templates>
93
        </xsl:otherwise>
94
       </xsl:choose> 
95
      </table>
96
  </xsl:template>
97

    
98
  <!-- ********************************************************************* -->
99
  <!-- *******************************  Online data  *********************** -->
100
  <!-- ********************************************************************* -->
101
  <xsl:template match="online">
102
    <xsl:param name="disfirstColStyle"/>
103
    <xsl:param name="dissubHeaderStyle"/>
104
    <tr><td class="{$dissubHeaderStyle}" colspan="2">
105
        <xsl:text>Online Distribution Info:</xsl:text>
106
    </td></tr>
107
    <xsl:apply-templates select="url">
108
      <xsl:with-param name="disfirstColStyle" select="$disfirstColStyle" />
109
    </xsl:apply-templates>
110
    <xsl:apply-templates select="connection">
111
      <xsl:with-param name="disfirstColStyle" select="$disfirstColStyle" />
112
    </xsl:apply-templates>
113
    <xsl:apply-templates select="connectionDefinition">
114
      <xsl:with-param name="disfirstColStyle" select="$disfirstColStyle" />
115
    </xsl:apply-templates>
116
  </xsl:template>
117
  
118
  <xsl:template match="url">
119
    <xsl:param name="disfirstColStyle"/>
120
    <tr>
121
      <td width="{$firstColWidth}" class="{$disfirstColStyle}">
122
        <xsl:text>&#160;</xsl:text>
123
      </td>
124
      <td width="{$secondColWidth}" class="{$secondColStyle}">
125
         <a>
126
          <xsl:attribute name="href"><xsl:value-of select="."/></xsl:attribute>
127
          <xsl:attribute name="target">_blank</xsl:attribute>
128
          <xsl:value-of select="."/>
129
        </a>
130
       </td>
131
    </tr>
132
  </xsl:template>
133
  
134
  <xsl:template match="connection">
135
    <xsl:param name="disfirstColStyle"/>
136
    <xsl:choose>
137
      <xsl:when test="references!=''">
138
        <xsl:variable name="ref_id" select="references"/>
139
        <xsl:variable name="references" select="$ids[@id=$ref_id]" />
140
        <xsl:for-each select="$references">
141
          <xsl:call-template name="connectionCommon">
142
            <xsl:with-param name="disfirstColStyle" select="$disfirstColStyle"/>
143
          </xsl:call-template>
144
        </xsl:for-each>
145
      </xsl:when>
146
      <xsl:otherwise>
147
        <xsl:call-template name="connectionCommon">
148
          <xsl:with-param name="disfirstColStyle" select="$disfirstColStyle"/>
149
        </xsl:call-template>
150
      </xsl:otherwise>
151
    </xsl:choose>
152
  </xsl:template>
153
  
154
  <!-- A template shared by connection references and connection in line-->
155
  <xsl:template name="connectionCommon">
156
    <xsl:param name="disfirstColStyle"/>
157
    <xsl:if test="parameter">
158
      <tr>
159
        <td width="{$firstColWidth}" class="{$disfirstColStyle}">
160
          <xsl:text>Parameter(s):</xsl:text>
161
        </td>
162
        <td width="{$secondColWidth}" class="{$secondColStyle}"><xsl:text>&#160;</xsl:text>
163
        </td>
164
      </tr>
165
      <xsl:call-template name="renderParameters">
166
        <xsl:with-param name="disfirstColStyle" select="$disfirstColStyle" />
167
      </xsl:call-template>
168
    </xsl:if>
169
    <xsl:apply-templates select="connectionDefinition">
170
      <xsl:with-param name="disfirstColStyle" select="$disfirstColStyle" />
171
    </xsl:apply-templates>
172
  </xsl:template>
173
  
174
  <xsl:template name="renderParameters">
175
    <xsl:param name="disfirstColStyle"/>
176
    <xsl:for-each select="parameter" >
177
      <tr>
178
        <td width="{$firstColWidth}" class="{$disfirstColStyle}">
179
          <xsl:text>&#160;&#160;&#160;&#160;&#160;</xsl:text><xsl:value-of select="name" />
180
        </td>
181
        <td width="{$secondColWidth}" class="{$secondColStyle}">
182
         <xsl:value-of select="value" />
183
        </td>
184
      </tr>
185
    </xsl:for-each>
186
  </xsl:template>
187
  
188
   <xsl:template match="connectionDefinition">
189
    <xsl:param name="disfirstColStyle"/>
190
    <xsl:choose>
191
      <xsl:when test="references!=''">
192
        <xsl:variable name="ref_id" select="references"/>
193
        <xsl:variable name="references" select="$ids[@id=$ref_id]" />
194
        <xsl:for-each select="$references">
195
          <xsl:call-template name="connectionDefinitionCommon">
196
            <xsl:with-param name="disfirstColStyle" select="$disfirstColStyle"/>
197
          </xsl:call-template>
198
        </xsl:for-each>
199
      </xsl:when>
200
      <xsl:otherwise>
201
        <xsl:call-template name="connectionDefinitionCommon">
202
          <xsl:with-param name="disfirstColStyle" select="$disfirstColStyle"/>
203
        </xsl:call-template>
204
      </xsl:otherwise>
205
    </xsl:choose>
206
   </xsl:template>
207
   
208
   <!-- This template will be shared by both reference and inline connectionDefinition-->
209
   <xsl:template name="connectionDefinitionCommon">
210
    <xsl:param name="disfirstColStyle"/>
211
      <tr>
212
          <td width="{$firstColWidth}" class="{$disfirstColStyle}">
213
            <xsl:text>Schema Name:</xsl:text>
214
          </td>
215
          <td width="{$secondColWidth}" class="{$secondColStyle}">
216
            <xsl:value-of select="schemeName" />
217
          </td>
218
       </tr>
219
       <tr>
220
          <td width="{$firstColWidth}" class="{$disfirstColStyle}">
221
            <xsl:text>Description:</xsl:text>
222
          </td>
223
          <td width="{$secondColWidth}">
224
           <xsl:apply-templates select="description">
225
              <xsl:with-param name="disfirstColStyle" select="$disfirstColStyle" />
226
            </xsl:apply-templates>
227
          </td>
228
       </tr>
229
       <xsl:for-each select="parameterDefinition">
230
          <xsl:call-template name="renderParameterDefinition">
231
            <xsl:with-param name="disfirstColStyle" select="$disfirstColStyle" />
232
          </xsl:call-template>
233
       </xsl:for-each>
234
   </xsl:template>
235
   
236
   <xsl:template match="description">
237
     <xsl:param name="disfirstColStyle"/>
238
     <xsl:call-template name="text">
239
        <xsl:with-param name="textfirstColStyle" select="$secondColStyle" />
240
     </xsl:call-template>
241
   </xsl:template>
242
   
243
   <xsl:template name="renderParameterDefinition">
244
     <xsl:param name="disfirstColStyle"/>
245
     <tr>
246
        <td width="{$firstColWidth}" class="{$disfirstColStyle}">
247
          <xsl:text>&#160;&#160;&#160;&#160;&#160;</xsl:text><xsl:value-of select="name" /><xsl:text>:</xsl:text>
248
        </td>
249
        <td width="{$secondColWidth}">
250
          <table xsl:use-attribute-sets="cellspacing" class="tabledefault" width="100%">
251
            <tr>
252
              <td width="{$firstColWidth}" class="{$disfirstColStyle}">
253
                <xsl:choose>
254
                  <xsl:when test="defaultValue">
255
                    <xsl:value-of select="defaultValue" />
256
                  </xsl:when>
257
                  <xsl:otherwise>
258
                    &#160;
259
                  </xsl:otherwise>
260
                </xsl:choose>
261
                
262
              </td>
263
              <td width="{$secondColWidth}" class="{$secondColStyle}">
264
                <xsl:value-of select="definition" />
265
              </td>
266
            </tr>
267
          </table>
268
        </td>
269
      </tr>
270
   </xsl:template>
271
  
272
  <!-- ********************************************************************* -->
273
  <!-- *******************************  Offline data  ********************** -->
274
  <!-- ********************************************************************* -->
275
  
276
  <xsl:template match="offline">
277
    <xsl:param name="disfirstColStyle"/>
278
    <xsl:param name="dissubHeaderStyle"/>
279
    <tr><td class="{$dissubHeaderStyle}" colspan="2">
280
        <xsl:text>Offline Distribution Info:</xsl:text>
281
    </td></tr>
282
    <xsl:if test="(mediumName) and normalize-space(mediumName)!=''">
283
      <tr><td width="{$firstColWidth}" class="{$disfirstColStyle}"><xsl:text>Medium:</xsl:text></td>
284
      <td width="{$secondColWidth}" class="{$secondColStyle}"><xsl:value-of select="mediumName"/></td></tr>
285
    </xsl:if>
286
    <xsl:if test="(mediumDensity) and normalize-space(mediumDensity)!=''">
287
    <tr><td width="{$firstColWidth}" class="{$disfirstColStyle}"><xsl:text>Medium Density:</xsl:text></td>
288
    <td width="{$secondColWidth}" class="{$secondColStyle}"><xsl:value-of select="mediumDensity"/>
289
    <xsl:if test="(mediumDensityUnits) and normalize-space(mediumDensityUnits)!=''">
290
    <xsl:text> (</xsl:text><xsl:value-of select="mediumDensityUnits"/><xsl:text>)</xsl:text>
291
    </xsl:if>
292
    </td></tr>
293
    </xsl:if>
294
    <xsl:if test="(mediumVol) and normalize-space(mediumVol)!=''">
295
    <tr><td width="{$firstColWidth}" class="{$disfirstColStyle}"><xsl:text>Volume:</xsl:text></td>
296
    <td width="{$secondColWidth}" class="{$secondColStyle}"><xsl:value-of select="mediumVol"/></td></tr>
297
    </xsl:if>
298
    <xsl:if test="(mediumFormat) and normalize-space(mediumFormat)!=''">
299
    <tr><td width="{$firstColWidth}" class="{$disfirstColStyle}"><xsl:text>Format:</xsl:text></td>
300
    <td width="{$secondColWidth}" class="{$secondColStyle}"><xsl:value-of select="mediumFormat"/></td></tr>
301
    </xsl:if>
302
    <xsl:if test="(mediumNote) and normalize-space(mediumNote)!=''">
303
    <tr><td width="{$firstColWidth}" class="{$disfirstColStyle}"><xsl:text>Notes:</xsl:text></td>
304
    <td width="{$secondColWidth}" class="{$secondColStyle}"><xsl:value-of select="mediumNote"/></td></tr>
305
    </xsl:if>
306
  </xsl:template>
307
  
308
  <!-- ********************************************************************* -->
309
  <!-- *******************************  Inline data  *********************** -->
310
  <!-- ********************************************************************* -->  
311
  
312
  
313
  <xsl:template match="inline">
314
    <xsl:param name="disfirstColStyle"/>
315
    <xsl:param name="dissubHeaderStyle"/>
316
    <xsl:param name="docid"/>
317
    <xsl:param name="level">entity</xsl:param>
318
    <xsl:param name="entitytype"/>
319
    <xsl:param name="entityindex"/>
320
    <xsl:param name="physicalindex"/>
321
    <xsl:param name="distributionindex"/>
322
    
323
    <tr><td class="{$dissubHeaderStyle}" colspan="2">
324
        <xsl:text>Inline Data:</xsl:text>
325
    </td></tr>
326
    <tr><td width="{$firstColWidth}" class="{$disfirstColStyle}">
327
      <xsl:text>&#160;</xsl:text></td>
328
      <td width="{$secondColWidth}" class="{$secondColStyle}">
329
      <!-- for top top distribution-->
330
      <xsl:if test="$level='toplevel'">
331
        <a><xsl:attribute name="href"><xsl:value-of select="$tripleURI"/><xsl:value-of select="$docid"/>&amp;displaymodule=inlinedata&amp;distributionlevel=<xsl:value-of select="$level"/>&amp;distributionindex=<xsl:value-of select="$distributionindex"/></xsl:attribute>
332
        <b>Inline Data</b></a>
333
      </xsl:if>
334
      <xsl:if test="$level='entitylevel'">
335
        <a><xsl:attribute name="href"><xsl:value-of select="$tripleURI"/><xsl:value-of select="$docid"/>&amp;displaymodule=inlinedata&amp;distributionlevel=<xsl:value-of select="$level"/>&amp;entitytype=<xsl:value-of select="$entitytype"/>&amp;entityindex=<xsl:value-of select="$entityindex"/>&amp;physicalindex=<xsl:value-of select="$physicalindex"/>&amp;distributionindex=<xsl:value-of select="$distributionindex"/></xsl:attribute>
336
        <b>Inline Data</b></a>
337
      </xsl:if>
338
     </td></tr>
339
  </xsl:template>
340
   
341
  
342
</xsl:stylesheet>
(12-12/30)