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: cjones $'
10
  *     '$Date: 2006-11-17 13:37:07 -0800 (Fri, 17 Nov 2006) $'
11
  * '$Revision: 3094 $'
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
              doctype-public="-//W3C//DTD HTML 4.01 Transitional//EN"
36
              doctype-system="http://www.w3.org/TR/html4/loose.dtd"
37
              indent="yes" />  
38

    
39
  <!-- This module is for party member and it is self contained-->
40

    
41
  <xsl:template name="party">
42
      <xsl:param name="partyfirstColStyle"/>
43
      <table class="{$tabledefaultStyle}">
44
        <xsl:choose>
45
         <xsl:when test="references!=''">
46
          <xsl:variable name="ref_id" select="references"/>
47
          <xsl:variable name="references" select="$ids[@id=$ref_id]" />
48
          <xsl:for-each select="$references">
49
            <xsl:apply-templates mode="party">
50
             <xsl:with-param name="partyfirstColStyle" select="$partyfirstColStyle"/>
51
            </xsl:apply-templates>
52
          </xsl:for-each>
53
        </xsl:when>
54
        <xsl:otherwise>
55
          <xsl:apply-templates mode="party">
56
            <xsl:with-param name="partyfirstColStyle" select="$partyfirstColStyle"/>
57
          </xsl:apply-templates>
58
        </xsl:otherwise>
59
      </xsl:choose>
60
      </table>
61
  </xsl:template>
62

    
63
  <!-- *********************************************************************** -->
64

    
65

    
66
  <xsl:template match="individualName" mode="party">
67
      <xsl:param name="partyfirstColStyle"/>
68
      <xsl:if test="normalize-space(.)!=''">
69
        <tr><td class="{$partyfirstColStyle}" >
70
            Individual:</td><td class="{$secondColStyle}" >
71
           <b><xsl:value-of select="./salutation"/><xsl:text> </xsl:text>
72
           <xsl:value-of select="./givenName"/><xsl:text> </xsl:text>
73
           <xsl:value-of select="./surName"/></b>
74
        </td></tr>
75
      </xsl:if>
76
  </xsl:template>
77

    
78

    
79
  <xsl:template match="organizationName" mode="party">
80
      <xsl:param name="partyfirstColStyle"/>
81
      <xsl:if test="normalize-space(.)!=''">
82
        <tr><td class="{$partyfirstColStyle}" >
83
        Organization:</td><td class="{$secondColStyle}">
84
        <b><xsl:value-of select="."/></b>
85
        </td></tr>
86
      </xsl:if>
87
  </xsl:template>
88

    
89

    
90
  <xsl:template match="positionName" mode="party">
91
      <xsl:param name="partyfirstColStyle"/>
92
      <xsl:if test="normalize-space(.)!=''">
93
      <tr><td class="{$partyfirstColStyle}">
94
        Position:</td><td class="{$secondColStyle}">
95
        <xsl:value-of select="."/></td></tr>
96
      </xsl:if>
97
  </xsl:template>
98

    
99

    
100
  <xsl:template match="address" mode="party">
101
    <xsl:param name="partyfirstColStyle"/>
102
    <xsl:if test="normalize-space(.)!=''">
103
      <xsl:call-template name="addressCommon">
104
         <xsl:with-param name="partyfirstColStyle" select="$partyfirstColStyle"/>
105
      </xsl:call-template>
106
    </xsl:if>
107
    </xsl:template>
108

    
109
   <!-- This template will be call by other place-->
110
   <xsl:template name="address">
111
      <xsl:param name="partyfirstColStyle"/>
112
      <table class="{$tablepartyStyle}">
113
        <xsl:choose>
114
         <xsl:when test="references!=''">
115
          <xsl:variable name="ref_id" select="references"/>
116
          <xsl:variable name="references" select="$ids[@id=$ref_id]" />
117
          <xsl:for-each select="$references">
118
            <xsl:call-template name="addressCommon">
119
             <xsl:with-param name="partyfirstColStyle" select="$partyfirstColStyle"/>
120
            </xsl:call-template>
121
          </xsl:for-each>
122
        </xsl:when>
123
        <xsl:otherwise>
124
          <xsl:call-template name="addressCommon">
125
             <xsl:with-param name="partyfirstColStyle" select="$partyfirstColStyle"/>
126
          </xsl:call-template>
127
        </xsl:otherwise>
128
      </xsl:choose>
129
      </table>
130
  </xsl:template>
131

    
132
   <xsl:template name="addressCommon">
133
    <xsl:param name="partyfirstColStyle"/>
134
    <xsl:if test="normalize-space(.)!=''">
135
    <tr><td class="{$partyfirstColStyle}">
136
        Address:</td><td>
137
    <table class="{$tablepartyStyle}">
138
    <xsl:for-each select="deliveryPoint">
139
    <tr><td class="{$secondColStyle}"><xsl:value-of select="."/><xsl:text>, </xsl:text></td></tr>
140
    </xsl:for-each>
141
    <!-- only include comma if city exists... -->
142
    <tr><td class="{$secondColStyle}" >
143
    <xsl:if test="normalize-space(city)!=''">
144
        <xsl:value-of select="city"/><xsl:text>, </xsl:text>
145
    </xsl:if>
146
    <xsl:if test="normalize-space(administrativeArea)!='' or normalize-space(postalCode)!=''">
147
        <xsl:value-of select="administrativeArea"/><xsl:text> </xsl:text><xsl:value-of select="postalCode"/><xsl:text> </xsl:text>
148
    </xsl:if>
149
    <xsl:if test="normalize-space(country)!=''">
150
      <xsl:value-of select="country"/>
151
    </xsl:if></td></tr>
152
    </table></td></tr>
153
    </xsl:if>
154
   </xsl:template>
155

    
156
  <xsl:template match="phone" mode="party">
157
      <xsl:param name="partyfirstColStyle"/>
158
      <tr><td class="{$partyfirstColStyle}" >
159
             Phone:
160
          </td>
161
          <td>
162
            <table class="{$tablepartyStyle}">
163
              <tr><td class="{$secondColStyle}">
164
                     <xsl:value-of select="."/>
165
                     <xsl:if test="normalize-space(./@phonetype)!=''">
166
                       <xsl:text> (</xsl:text><xsl:value-of select="./@phonetype"/><xsl:text>)</xsl:text>
167
                     </xsl:if>
168
                   </td>
169
               </tr>
170
             </table>
171
          </td>
172
      </tr>
173
  </xsl:template>
174

    
175

    
176
  <xsl:template match="electronicMailAddress" mode="party">
177
      <xsl:param name="partyfirstColStyle"/>
178
      <xsl:if test="normalize-space(.)!=''">
179
       <tr><td class="{$partyfirstColStyle}" >
180
            Email Address:
181
          </td>
182
          <td>
183
            <table class="{$tablepartyStyle}">
184
              <tr><td class="{$secondColStyle}">
185
                    <a><xsl:attribute name="href">mailto:<xsl:value-of select="."/></xsl:attribute><xsl:value-of select="./entityName"/>
186
                    <xsl:value-of select="."/></a>
187
                   </td>
188
              </tr>
189
            </table>
190
          </td>
191
        </tr>
192
      </xsl:if>
193
  </xsl:template>
194

    
195

    
196
  <xsl:template match="onlineUrl" mode="party">
197
      <xsl:param name="partyfirstColStyle"/>
198
      <xsl:if test="normalize-space(.)!=''">
199
      <tr><td class="{$partyfirstColStyle}" >
200
            Web Address:
201
          </td>
202
          <td>
203
             <table class="{$tablepartyStyle}">
204
               <tr><td class="{$secondColStyle}">
205
                     <a><xsl:attribute name="href">http://<xsl:value-of select="."/></xsl:attribute><xsl:value-of select="./entityName"/>
206
                     <xsl:value-of select="."/></a>
207
                    </td>
208
               </tr>
209
             </table>
210
           </td>
211
        </tr>
212
      </xsl:if>
213
  </xsl:template>
214

    
215

    
216
  <xsl:template match="userId" mode="party">
217
      <xsl:param name="partyfirstColStyle"/>
218
      <xsl:if test="normalize-space(.)!=''">
219
      <tr><td class="{$partyfirstColStyle}" >
220
        Id:</td><td class="{$secondColStyle}">
221
        <xsl:value-of select="."/></td></tr>
222
      </xsl:if>
223
  </xsl:template>
224
  <xsl:template match="text()" mode="party" />
225
</xsl:stylesheet>
(15-15/27)