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: mecum $'
10
  *     '$Date: 2017-10-10 11:20:46 -0700 (Tue, 10 Oct 2017) $'
11
  * '$Revision: 10426 $'
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 
33
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
34
    <xsl:output method="html" 
35
        encoding="UTF-8" 
36
        doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN" 
37
        doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" 
38
        indent="yes" />
39
    
40
    <xsl:template name="text">
41
        <xsl:apply-templates />
42
    </xsl:template>
43

    
44
    <xsl:template match="section">
45
        <div class="sectionText">
46
            <xsl:apply-templates />
47
        </div>
48
    </xsl:template>
49

    
50
    <xsl:template match="para">
51
        <p>
52
            <xsl:apply-templates />
53
        </p>
54
    </xsl:template>
55

    
56
    <!-- This template dynamically decides on h4-h6 depending on how deeply nested its parent section element is in the
57
    document. -->
58
    <xsl:template match="title">
59
        <xsl:choose>
60
            <xsl:when test="count(ancestor::section) > 2">
61
                <b>
62
                    <xsl:apply-templates />
63
                </b>
64
            </xsl:when>
65
            <xsl:when test="count(ancestor::section) > 1">
66
                <h6>
67
                    <xsl:apply-templates />
68
                </h6>
69
            </xsl:when>
70
            <xsl:otherwise>
71
                <h5>
72
                    <xsl:apply-templates />
73
                </h5>
74
            </xsl:otherwise>
75
        </xsl:choose>
76
    </xsl:template>
77

    
78
    <xsl:template match="orderedlist">
79
        <ol>
80
            <xsl:apply-templates />
81
        </ol>
82
    </xsl:template>
83

    
84
    <xsl:template match="itemizedlist">
85
        <ul>
86
            <xsl:apply-templates />
87
        </ul>
88
    </xsl:template>
89

    
90
    <xsl:template match="listitem">
91
        <li>
92
            <xsl:apply-templates />
93
        </li>
94
    </xsl:template>
95

    
96
    <xsl:template match="emphasis">
97
        <em>
98
            <xsl:apply-templates />
99
        </em>
100
    </xsl:template>
101

    
102
    <xsl:template match="literalLayout">
103
        <pre>
104
            <xsl:apply-templates />
105
        </pre>
106
    </xsl:template>
107

    
108
    <!-- Note: This template doesn't fully support ulink in that a single ulink can have multiple citetitle's and
109
    translations and this template only uses the first citetitle and disregards internationalization details.-->
110
    <xsl:template match="ulink">
111
        <xsl:element name="a">
112
            <xsl:attribute name="href">
113
                <xsl:value-of select="./@url" />
114
            </xsl:attribute>
115
            <xsl:attribute name="target">_default</xsl:attribute>
116
            <xsl:apply-templates />
117
        </xsl:element>
118
    </xsl:template>
119

    
120
    <xsl:template match="superscript">
121
        <sup>
122
            <xsl:apply-templates />
123
        </sup>
124
    </xsl:template>
125

    
126
    <xsl:template match="subscript">
127
        <sub>
128
            <xsl:apply-templates />
129
        </sub>
130
    </xsl:template>
131

    
132
    <xsl:template match="value">
133
        <xsl:if test="./text() != ''">
134
            <p class="translation">
135
                <xsl:if test="./@xml:lang != ''">
136
                    (<xsl:value-of select="./@xml:lang"/>)
137
                </xsl:if>
138
                <xsl:value-of select="./text()"/>
139
            </p>
140
        </xsl:if>
141
    </xsl:template>
142
</xsl:stylesheet>
(25-25/27)