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