Project

General

Profile

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