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
34
  <xsl:output method="html" encoding="iso-8859-1"/>
35
36
  <!-- This module is for party member and it is self contained-->
37
38
  <xsl:template name="party">
39
      <xsl:param name="partyfirstColStyle"/>
40
      <table class="tabledefault" width="100%">
41
        <xsl:choose>
42
         <xsl:when test="references!=''">
43
          <xsl:variable name="ref_id" select="references"/>
44
          <xsl:variable name="references" select="$ids[@id=$ref_id]" />
45
          <xsl:for-each select="$references">
46
            <xsl:apply-templates mode="party">
47
             <xsl:with-param name="partyfirstColStyle" select="$partyfirstColStyle"/>
48
            </xsl:apply-templates>
49
          </xsl:for-each>
50
        </xsl:when>
51
        <xsl:otherwise>
52
          <xsl:apply-templates mode="party">
53
            <xsl:with-param name="partyfirstColStyle" select="$partyfirstColStyle"/>
54
          </xsl:apply-templates>
55
        </xsl:otherwise>
56
      </xsl:choose>
57
      </table>
58
  </xsl:template>
59
60
  <!-- *********************************************************************** -->
61
62
63
  <xsl:template match="individualName" mode="party">
64
      <xsl:param name="partyfirstColStyle"/>
65
      <xsl:if test="normalize-space(.)!=''">
66
        <tr><td width="{$firstColWidth}" class="{$partyfirstColStyle}" >
67
            Individual:</td><td width="{$secondColWidth}" class="{$secondColStyle}" >
68
           <xsl:value-of select="./salutation"/><xsl:text> </xsl:text>
69
           <xsl:value-of select="./givenName"/><xsl:text> </xsl:text>
70
           <xsl:value-of select="./surName"/>
71
        </td></tr>
72
      </xsl:if>
73
  </xsl:template>
74
75
76
  <xsl:template match="organizationName" mode="party">
77
      <xsl:param name="partyfirstColStyle"/>
78
      <xsl:if test="normalize-space(.)!=''">
79
        <tr><td width="{$firstColWidth}" class="{$partyfirstColStyle}" >
80
        Organization:</td><td width="{$secondColWidth}" class="{$secondColStyle}">
81
        <xsl:value-of select="."/>
82
        </td></tr>
83
      </xsl:if>
84
  </xsl:template>
85
86
87
  <xsl:template match="positionName" mode="party">
88
      <xsl:param name="partyfirstColStyle"/>
89
      <xsl:if test="normalize-space(.)!=''">
90
      <tr><td width="{$firstColWidth}" class="{$partyfirstColStyle}">
91
        Position:</td><td width="{$secondColWidth}" class="{$secondColStyle}">
92
        <xsl:value-of select="."/></td></tr>
93
      </xsl:if>
94
  </xsl:template>
95
96
97
  <xsl:template match="address" mode="party">
98
    <xsl:param name="partyfirstColStyle"/>
99
    <xsl:if test="normalize-space(.)!=''">
100
    <tr><td width="{$firstColWidth}" valign="top" class="{$partyfirstColStyle}">
101
        Address:</td><td width="{$secondColWidth}" >
102
    <table width="100%">
103
    <xsl:for-each select="./deliveryPoint">
104
    <tr><td><xsl:value-of select="."/><xsl:text>, </xsl:text></td></tr>
105
    </xsl:for-each>
106
    <!-- only include comma if city exists... -->
107
    <xsl:if test="normalize-space(./city)!=''">
108
        <tr><td><xsl:value-of select="./city"/><xsl:text>, </xsl:text></td></tr>
109
    </xsl:if>
110
    <xsl:if test="normalize-space(./administrativeArea)!='' or normalize-space(./postalCode)!=''">
111
        <tr><td><xsl:value-of select="./administrativeArea"/><xsl:text> </xsl:text><xsl:value-of select="./postalCode"/></td></tr>
112
    </xsl:if>
113
    <xsl:if test="normalize-space(./country)!=''">
114
      <tr><td><xsl:value-of select="./country"/></td></tr>
115
    </xsl:if>
116
    </table></td></tr>
117
    </xsl:if>
118
    </xsl:template>
119
120
   <!-- This template will be call by other place-->
121
   <xsl:template name="address">
122
      <xsl:param name="partyfirstColStyle"/>
123
      <table class="tabledefault" width="100%">
124
        <xsl:choose>
125
         <xsl:when test="references!=''">
126
          <xsl:variable name="ref_id" select="references"/>
127
          <xsl:variable name="references" select="$ids[@id=$ref_id]" />
128
          <xsl:for-each select="$references">
129
            <xsl:call-template name="addressCommon">
130
             <xsl:with-param name="partyfirstColStyle" select="$partyfirstColStyle"/>
131
            </xsl:call-template>
132
          </xsl:for-each>
133
        </xsl:when>
134
        <xsl:otherwise>
135
          <xsl:call-template name="addressCommon">
136
             <xsl:with-param name="partyfirstColStyle" select="$partyfirstColStyle"/>
137
          </xsl:call-template>
138
        </xsl:otherwise>
139
      </xsl:choose>
140
      </table>
141
  </xsl:template>
142
143
   <xsl:template name="addressCommon">
144
    <xsl:param name="partyfirstColStyle"/>
145
    <xsl:if test="normalize-space(.)!=''">
146
    <tr><td width="{$firstColWidth}" valign="top" class="{$partyfirstColStyle}">
147
        Address:</td><td width="{$secondColWidth}" >
148
    <table width="100%">
149
    <xsl:for-each select="./deliveryPoint">
150
    <tr><td><xsl:value-of select="."/><xsl:text>, </xsl:text></td></tr>
151
    </xsl:for-each>
152
    <!-- only include comma if city exists... -->
153
    <xsl:if test="normalize-space(./city)!=''">
154
        <tr><td><xsl:value-of select="./city"/><xsl:text>, </xsl:text></td></tr>
155
    </xsl:if>
156
    <xsl:if test="normalize-space(./administrativeArea)!='' or normalize-space(./postalCode)!=''">
157
        <tr><td><xsl:value-of select="./administrativeArea"/><xsl:text> </xsl:text><xsl:value-of select="./postalCode"/></td></tr>
158
    </xsl:if>
159
    <xsl:if test="normalize-space(./country)!=''">
160
      <tr><td><xsl:value-of select="./country"/></td></tr>
161
    </xsl:if>
162
    </table></td></tr>
163
    </xsl:if>
164
   </xsl:template>
165
166
  <xsl:template match="phone" mode="party">
167
      <xsl:param name="partyfirstColStyle"/>
168
      <tr><td width="{$firstColWidth}" class="{$partyfirstColStyle}" >
169
        Phone:</td><td width="{$secondColWidth}" >
170
       <xsl:value-of select="."/>
171
       <xsl:if test="normalize-space(./@phonetype)!=''">
172
            <xsl:text> (</xsl:text><xsl:value-of select="./@phonetype"/><xsl:text>)</xsl:text>
173
       </xsl:if></td></tr>
174
  </xsl:template>
175
176
177
  <xsl:template match="electronicMailAddress" mode="party">
178
      <xsl:param name="partyfirstColStyle"/>
179
      <xsl:if test="normalize-space(.)!=''">
180
      <tr><td width="{$firstColWidth}" class="{$partyfirstColStyle}" >
181
        Email Address:</td><td width="{$secondColWidth}">
182
        <xsl:value-of select="."/></td></tr>
183
      </xsl:if>
184
  </xsl:template>
185
186
187
  <xsl:template match="onlineUrl" mode="party">
188
      <xsl:param name="partyfirstColStyle"/>
189
      <xsl:if test="normalize-space(.)!=''">
190
      <tr><td width="{$firstColWidth}" class="{$partyfirstColStyle}" >
191
        Web Address:</td><td width="{$secondColWidth}">
192
        <xsl:value-of select="."/></td></tr>
193
      </xsl:if>
194
  </xsl:template>
195
196
197
  <xsl:template match="userId" mode="party">
198
      <xsl:param name="partyfirstColStyle"/>
199
      <xsl:if test="normalize-space(.)!=''">
200
      <tr><td width="{$firstColWidth}" class="{$partyfirstColStyle}" >
201
        Id:</td><td width="{$secondColWidth}">
202
        <xsl:value-of select="."/></td></tr>
203
      </xsl:if>
204
  </xsl:template>
205
206
</xsl:stylesheet>