Project

General

Profile

metacat / lib / style / eml2 / eml-distribution-2.0.0.xsl @ 1689

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-06-08 18:43:04 -0700 (Sun, 08 Jun 2003) $'
11
  * '$Revision: 1650 $'
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
      
49
      <table class="tabledefault" width="100%">
50
       <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
               <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
          </xsl:for-each>
74
        </xsl:when>
75
        <xsl:otherwise>
76
            <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
        </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
          <td width="{$secondColWidth}" class="{$secondColStyle}">
225
           <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
          <xsl:text>&#160;&#160;&#160;&#160;&#160;</xsl:text><xsl:value-of select="name" />
249
        </td>
250
        <td width="{$secondColWidth}" class="{$secondColStyle}">
251
          <table class="tabledefault" width="100%">
252
            <tr>
253
              <td width="{$firstColWidth}" class="{$disfirstColStyle}">
254
                <xsl:value-of select="defaultValue" />
255
              </td>
256
              <td width="{$secondColWidth}" class="{$secondColStyle}">
257
                <xsl:value-of select="definition" />
258
              </td>
259
            </tr>
260
          </table>
261
        </td>
262
      </tr>
263
   </xsl:template>
264
  
265
  <!-- ********************************************************************* -->
266
  <!-- *******************************  Offline data  ********************** -->
267
  <!-- ********************************************************************* -->
268
  
269
  <xsl:template name="offline">
270
    <xsl:param name="disfirstColStyle"/>
271
    <xsl:param name="dissubHeaderStyle"/>
272
    <tr><td class="{$dissubHeaderStyle}" colspan="2">
273
        <xsl:text>Offline Distribution information:</xsl:text>
274
    </td></tr>
275
    <xsl:if test="(mediumName) and normalize-space(mediumName)!=''">
276
      <tr><td width="{$firstColWidth}" class="{$disfirstColStyle}"><xsl:text>Medium:</xsl:text></td>
277
      <td width="{$secondColWidth}" class="{$secondColStyle}"><xsl:value-of select="mediumName"/></td></tr>
278
    </xsl:if>
279
    <xsl:if test="(mediumDensity) and normalize-space(mediumDensity)!=''">
280
    <tr><td width="{$firstColWidth}" class="{$disfirstColStyle}"><xsl:text>Medium Density:</xsl:text></td>
281
    <td width="{$secondColWidth}" class="{$secondColStyle}"><xsl:value-of select="mediumDensity"/>
282
    <xsl:if test="(mediumDensityUnits) and normalize-space(mediumDensityUnits)!=''">
283
    <xsl:text> (</xsl:text><xsl:value-of select="mediumDensityUnits"/><xsl:text>)</xsl:text>
284
    </xsl:if>
285
    </td></tr>
286
    </xsl:if>
287
    <xsl:if test="(mediumVol) and normalize-space(mediumVol)!=''">
288
    <tr><td width="{$firstColWidth}" class="{$disfirstColStyle}"><xsl:text>Volume:</xsl:text></td>
289
    <td width="{$secondColWidth}" class="{$secondColStyle}"><xsl:value-of select="mediumVol"/></td></tr>
290
    </xsl:if>
291
    <xsl:if test="(mediumFormat) and normalize-space(mediumFormat)!=''">
292
    <tr><td width="{$firstColWidth}" class="{$disfirstColStyle}"><xsl:text>Format:</xsl:text></td>
293
    <td width="{$secondColWidth}" class="{$secondColStyle}"><xsl:value-of select="mediumFormat"/></td></tr>
294
    </xsl:if>
295
    <xsl:if test="(mediumNote) and normalize-space(mediumNote)!=''">
296
    <tr><td width="{$firstColWidth}" class="{$disfirstColStyle}"><xsl:text>Notes:</xsl:text></td>
297
    <td width="{$secondColWidth}" class="{$secondColStyle}"><xsl:value-of select="mediumNote"/></td></tr>
298
    </xsl:if>
299
  </xsl:template>
300
  
301
  <!-- ********************************************************************* -->
302
  <!-- *******************************  Inline data  *********************** -->
303
  <!-- ********************************************************************* -->  
304
  
305
  
306
  <xsl:template name="inline">
307
    <xsl:param name="disfirstColStyle"/>
308
    <xsl:param name="dissubHeaderStyle"/>
309
    <xsl:param name="docid"/>
310
    <xsl:param name="level">entity</xsl:param>
311
    <xsl:param name="entitytype"/>
312
    <xsl:param name="entityindex"/>
313
    <xsl:param name="physicalindex"/>
314
    <xsl:param name="distributionindex"/>
315
    
316
    <tr><td class="{$dissubHeaderStyle}" colspan="2">
317
        <xsl:text>Inline Data:</xsl:text>
318
    </td></tr>
319
    <tr><td width="{$firstColWidth}" class="{$disfirstColStyle}">
320
      <xsl:text>&#160;</xsl:text></td>
321
      <td width="{$secondColWidth}" class="{$secondColStyle}">
322
      <!-- for top top distribution-->
323
      <xsl:if test="$level='toplevel'">
324
        <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>
325
        <br>Inline Data</br></a>
326
      </xsl:if>
327
      <xsl:if test="$level='entitylevel'">
328
        <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>
329
        <br>Inline Data</br></a>
330
      </xsl:if>
331
     </td></tr>
332
  </xsl:template>
333
   
334
  
335
</xsl:stylesheet>