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-06-30 13:23:17 -0700 (Mon, 30 Jun 2003) $'
11
  * '$Revision: 1702 $'
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 xsl:use-attribute-sets="cellspacing" class="tabledefault" width="100%">
43
          <xsl:apply-templates  select="." mode="text"/>
44
        </table>
45
      </xsl:if>
46
  </xsl:template>
47
  
48

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

    
114
  <!-- para template for text mode-->
115
   <xsl:template match="para" mode="text">
116
    <xsl:param name="textfirstColStyle"/>
117
    <tr>
118
      <td width="100%" class="{$secondColStyle}">
119
         <xsl:apply-templates mode="lowlevel"/>    
120
      </td>
121
    </tr>
122
  </xsl:template>
123
 
124
  <!-- para template without table structure. It does actually transfer. 
125
       Currently, only get the text and it need more revision-->
126
  <xsl:template match="para" mode="lowlevel">
127
       <xsl:value-of select="."/>
128
  </xsl:template>
129

    
130
</xsl:stylesheet>
(29-29/30)