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: 2000-11-20 05:14:04 -0800 (Mon, 20 Nov 2000) $'
11
  * '$Revision: 553 $'
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
 
36

    
37
<!-- This module is for text module in eml2 document. It is a table and self contained-->
38

    
39
  <xsl:template name="text">
40
        <xsl:param name="textfirstColStyle" />
41
        <xsl:if test="(section and normalize-space(section)!='') or (para and normalize-space(para)!='')">
42
        <table class="tabledefault" width="100%">
43
          <xsl:apply-templates mode="text">
44
             <xsl:with-param name="textfirstColStyle" select="$textfirstColStyle"/>
45
          </xsl:apply-templates>
46
          
47
        </table>
48
      </xsl:if>
49
  </xsl:template>
50
  
51

    
52
  <!-- *********************************************************************** -->
53
  <!-- Template for section-->
54
   <xsl:template match="section" mode="text">
55
      <xsl:param name="textfirstColStyle" />
56
      <xsl:if test="normalize-space(.)!=''">
57
        <xsl:if test="title and normalize-space(title)!=''"> 
58
          <tr>
59
            <td width="{$firstColWidth}" align="right" class="{$textfirstColStyle}">
60
            Title:
61
            </td>
62
            <td width="{$secondColWidth}" class="{$secondColStyle}" >
63
              <xsl:value-of select="title"/>
64
            </td>
65
          </tr>
66
        </xsl:if>
67
        <xsl:if test="para and normalize-space(para)!=''">
68
          <tr>
69
            <td width="{$firstColWidth}" class="{$textfirstColStyle}">
70
              <xsl:text>&#160;</xsl:text>
71
            </td>
72
            <td width="{$secondColWidth}" class="{$secondColStyle}">
73
              <xsl:apply-templates select="para" mode="lowlevel"/>
74
            </td>
75
           </tr>
76
         </xsl:if>
77
         <xsl:if test="section and normalize-space(section)!=''">
78
          <tr>
79
            <td width="{$firstColWidth}" class="{$textfirstColStyle}">
80
            <xsl:text>&#160;</xsl:text>
81
            </td>
82
            <td width="{$secondColWidth}" class="{$secondColStyle}">
83
              <xsl:apply-templates select="section" mode="lowlevel"/>
84
            </td>
85
         </tr>
86
        </xsl:if>
87
      </xsl:if>
88
  </xsl:template>
89
  
90
  <!-- Section template for low level. Cteate a nested table and second column -->
91
  <xsl:template match="section" mode="lowlevel">
92
     <table width="100%">
93
      <xsl:if test="title and normalize-space(title)!=''">
94
        <tr>
95
          <td width="{$secondColIndent}" align="right" class="{$secondColStyle}">
96
            Title:
97
          </td>
98
          <td class="{$secondColStyle}">
99
            <xsl:value-of select="title"/>
100
          </td>
101
        </tr>
102
      </xsl:if>
103
      <xsl:if test="para and normalize-space(para)!=''">
104
        <tr>
105
          <td width="{$secondColIndent}"  class="{$secondColStyle}">
106
           <xsl:text>&#160;</xsl:text>
107
          </td>
108
          <td class="{$secondColStyle}">
109
            <xsl:apply-templates select="para" mode="lowlevel"/>
110
          </td>
111
        </tr>
112
       </xsl:if>
113
       <xsl:if test="section and normalize-space(section)!=''">
114
        <tr>
115
          <td width="{$secondColIndent}"  class="{$secondColStyle}">
116
            <xsl:text>&#160;</xsl:text>
117
          </td>
118
          <td class="{$secondColStyle}">
119
            <xsl:apply-templates select="setction" mode="lowlevel"/>
120
          </td>
121
        </tr>
122
       </xsl:if>
123
     </table>
124
  </xsl:template>
125

    
126
  <!-- para template for text mode-->
127
   <xsl:template match="para" mode="text">
128
    <xsl:param name="textfirstColStyle"/>
129
    <tr>
130
      <td width="{$firstColWidth}" class="{$textfirstColStyle}">&#160;</td>
131
      <td width="{$secondColWidth}" class="{$secondColStyle}">
132
         <xsl:apply-templates select="." mode="lowlevel"/>    
133
      </td>
134
    </tr>
135
  </xsl:template>
136
 
137
  <!-- para template without table structure. It does actually transfer. 
138
       Currently, only get the text and it need more revision-->
139
  <xsl:template match="para" mode="lowlevel">
140
       <xsl:value-of select="."/>
141
  </xsl:template>
142

    
143
</xsl:stylesheet>
(29-29/33)