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-07-01 18:32:06 -0700 (Tue, 01 Jul 2003) $'
11
  * '$Revision: 1715 $'
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 xsl:use-attribute-sets="cellspacing" 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
           <b><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"/></b>
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
        <b><xsl:value-of select="."/></b>
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
      <xsl:call-template name="addressCommon">
101
         <xsl:with-param name="partyfirstColStyle" select="$partyfirstColStyle"/>
102
      </xsl:call-template>
103
    </xsl:if>
104
    </xsl:template>
105
    
106
   <!-- This template will be call by other place-->
107
   <xsl:template name="address">
108
      <xsl:param name="partyfirstColStyle"/>
109
      <table xsl:use-attribute-sets="cellspacing" class="tableparty" width="100%">
110
        <xsl:choose>
111
         <xsl:when test="references!=''">
112
          <xsl:variable name="ref_id" select="references"/>
113
          <xsl:variable name="references" select="$ids[@id=$ref_id]" />
114
          <xsl:for-each select="$references">
115
            <xsl:call-template name="addressCommon">
116
             <xsl:with-param name="partyfirstColStyle" select="$partyfirstColStyle"/>
117
            </xsl:call-template>
118
          </xsl:for-each>
119
        </xsl:when>
120
        <xsl:otherwise>
121
          <xsl:call-template name="addressCommon">
122
             <xsl:with-param name="partyfirstColStyle" select="$partyfirstColStyle"/>
123
          </xsl:call-template>
124
        </xsl:otherwise>
125
      </xsl:choose>
126
      </table>
127
  </xsl:template>
128
   
129
   <xsl:template name="addressCommon">
130
    <xsl:param name="partyfirstColStyle"/>
131
    <xsl:if test="normalize-space(.)!=''">
132
    <tr><td width="{$firstColWidth}" valign="top" class="{$partyfirstColStyle}">
133
        Address:</td><td width="{$secondColWidth}" >
134
    <table xsl:use-attribute-sets="cellspacing" class="tableparty" width="100%">
135
    <xsl:for-each select="deliveryPoint">
136
    <tr><td class="{$secondColStyle}"><xsl:value-of select="."/><xsl:text>, </xsl:text></td></tr>
137
    </xsl:for-each>
138
    <!-- only include comma if city exists... -->
139
    <tr><td class="{$secondColStyle}" >
140
    <xsl:if test="normalize-space(city)!=''">
141
        <xsl:value-of select="city"/><xsl:text>, </xsl:text>
142
    </xsl:if>
143
    <xsl:if test="normalize-space(administrativeArea)!='' or normalize-space(postalCode)!=''">
144
        <xsl:value-of select="administrativeArea"/><xsl:text> </xsl:text><xsl:value-of select="postalCode"/><xsl:text> </xsl:text>
145
    </xsl:if>
146
    <xsl:if test="normalize-space(country)!=''">
147
      <xsl:value-of select="country"/>
148
    </xsl:if></td></tr>
149
    </table></td></tr>
150
    </xsl:if>
151
   </xsl:template>
152
 
153
  <xsl:template match="phone" mode="party">
154
      <xsl:param name="partyfirstColStyle"/>
155
      <tr><td width="{$firstColWidth}" class="{$partyfirstColStyle}" >
156
             Phone:
157
          </td>
158
          <td width="{$secondColWidth}">
159
            <table xsl:use-attribute-sets="cellspacing" class="tableparty" width="100%">
160
              <tr><td width="100%" class="{$secondColStyle}">
161
                     <xsl:value-of select="."/>
162
                     <xsl:if test="normalize-space(./@phonetype)!=''">
163
                       <xsl:text> (</xsl:text><xsl:value-of select="./@phonetype"/><xsl:text>)</xsl:text>
164
                     </xsl:if>
165
                   </td>
166
               </tr>
167
             </table>
168
          </td>
169
      </tr>
170
  </xsl:template>
171

    
172
 
173
  <xsl:template match="electronicMailAddress" mode="party">
174
      <xsl:param name="partyfirstColStyle"/>
175
      <xsl:if test="normalize-space(.)!=''">
176
       <tr><td width="{$firstColWidth}" class="{$partyfirstColStyle}" >
177
            Email Address:
178
          </td>
179
          <td width="{$secondColWidth}">
180
            <table xsl:use-attribute-sets="cellspacing" class="tableparty" width="100%">
181
              <tr><td width="100%" class="{$secondColStyle}">
182
                    <a><xsl:attribute name="href">mailto:<xsl:value-of select="."/></xsl:attribute><xsl:value-of select="./entityName"/>
183
                    <xsl:value-of select="."/></a>
184
                   </td>
185
              </tr>
186
            </table>
187
          </td>
188
        </tr>
189
      </xsl:if>
190
  </xsl:template>
191

    
192
  
193
  <xsl:template match="onlineUrl" mode="party">
194
      <xsl:param name="partyfirstColStyle"/> 
195
      <xsl:if test="normalize-space(.)!=''">
196
      <tr><td width="{$firstColWidth}" class="{$partyfirstColStyle}" >
197
            Web Address:
198
          </td>
199
          <td width="{$secondColWidth}">
200
             <table xsl:use-attribute-sets="cellspacing" class="tableparty" width="100%">
201
               <tr><td width="100%" class="{$secondColStyle}">
202
                     <a><xsl:attribute name="href">http://<xsl:value-of select="."/></xsl:attribute><xsl:value-of select="./entityName"/>
203
                     <xsl:value-of select="."/></a>
204
                    </td>
205
               </tr>
206
             </table>
207
           </td>
208
        </tr>
209
      </xsl:if>
210
  </xsl:template>
211

    
212

    
213
  <xsl:template match="userId" mode="party">
214
      <xsl:param name="partyfirstColStyle"/>
215
      <xsl:if test="normalize-space(.)!=''">
216
      <tr><td width="{$firstColWidth}" class="{$partyfirstColStyle}" >
217
        Id:</td><td width="{$secondColWidth}" class="{$secondColStyle}">
218
        <xsl:value-of select="."/></td></tr>
219
      </xsl:if>
220
  </xsl:template>
221
  <xsl:template match="text()" mode="party" />
222
</xsl:stylesheet>
(18-18/30)