Project

General

Profile

1 7982 leinfelder
<?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="UTF-8"
35
    doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN"
36
    doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"
37
    indent="yes" />
38
39
    <!-- style the identifier and system -->
40
    <xsl:template name="identifier">
41
      <xsl:param name="IDfirstColStyle"/>
42
      <xsl:param name="IDsecondColStyle"/>
43
      <xsl:param name="packageID"/>
44
      <xsl:param name="system"/>
45
      <xsl:if test="normalize-space(.)">
46 7986 leinfelder
        <div class="control-group">
47 8003 leinfelder
          <label class="control-label">Identifier</label>
48 7986 leinfelder
          <div class="controls">
49 7987 leinfelder
          	<div class="controls-well">
50
          		<xsl:value-of select="$packageID"/>
51
          	</div>
52 7982 leinfelder
			<xsl:if test="$withHTMLLinks = '1'">
53
	          	<!-- stats loaded with ajax call -->
54
				<span id="stats"></span>
55
				<script language="JavaScript">
56
					if (window.loadStats) {
57
						loadStats(
58
							'stats',
59
							'<xsl:value-of select="$packageID" />',
60
							'<xsl:value-of select="$contextURL" />/metacat',
61
							'<xsl:value-of select="$qformat" />');
62
					}
63
				</script>
64
			</xsl:if>
65 7986 leinfelder
66
          </div>
67
        </div>
68 7982 leinfelder
      </xsl:if>
69
    </xsl:template>
70
71
    <!-- for citation information -->
72
    <xsl:template name="datasetcitation">
73 7985 leinfelder
74 9135 walker
    	<cite class="citation">
75 7985 leinfelder
    				<xsl:for-each select="creator">
76 8072 leinfelder
77
    					<xsl:choose>
78
							<xsl:when test="references!=''">
79
							 <xsl:variable name="ref_id" select="references"/>
80
							 <xsl:variable name="references" select="$ids[@id=$ref_id]" />
81
							 <xsl:for-each select="$references">
82
83
							 	<!-- process the reference -->
84
							 	<xsl:if test="position() &gt; 1">
85
				        			<xsl:if test="last() &gt; 2">, </xsl:if>
86
				        			<xsl:if test="position() = last()"> and</xsl:if>
87
				        			<xsl:text> </xsl:text>
88
				        		</xsl:if>
89
				        		<xsl:call-template name="creatorCitation" />
90
				        		<xsl:if test="position() = last()">.</xsl:if>
91
				        		<xsl:text> </xsl:text>
92
93
							 </xsl:for-each>
94
							</xsl:when>
95
							<xsl:otherwise>
96
97
								<!-- just the creator element -->
98
								<xsl:if test="position() &gt; 1">
99
				        			<xsl:if test="last() &gt; 2">, </xsl:if>
100
				        			<xsl:if test="position() = last()"> and</xsl:if>
101
				        			<xsl:text> </xsl:text>
102
				        		</xsl:if>
103
				        		<xsl:call-template name="creatorCitation" />
104
				        		<xsl:if test="position() = last()">.</xsl:if>
105
				        		<xsl:text> </xsl:text>
106
107
							</xsl:otherwise>
108
						</xsl:choose>
109
110 7985 leinfelder
		        	</xsl:for-each>
111
112
		        	<xsl:value-of select="substring(string(pubDate),1,4)"/>
113
		        	<xsl:if test="substring(string(pubDate),1,4) != ''">
114
		        		<xsl:text>. </xsl:text>
115
		        	</xsl:if>
116
117
		        	<!-- title -->
118
					<strong>
119
					<xsl:for-each select="./title">
120
			     		<xsl:call-template name="i18n">
121
			     			<xsl:with-param name="i18nElement" select="."/>
122
			     		</xsl:call-template>
123
		        		<xsl:text> </xsl:text>
124
			     	</xsl:for-each>
125
					</strong>
126
127
					<!-- show link? -->
128
					<xsl:if test="$withHTMLLinks = '1'">
129 8071 leinfelder
						<a id="viewMetadataCitationLink">
130 7985 leinfelder
							<xsl:attribute name="href">
131 8071 leinfelder
								<!--<xsl:value-of select="$viewURI"/><xsl:value-of select="$pid"/>-->
132
								<xsl:text>#view/</xsl:text><xsl:value-of select="$pid"/>
133
							</xsl:attribute>
134 8032 leinfelder
							(<xsl:value-of select="$pid"/>)
135 7985 leinfelder
						</a>
136
					</xsl:if>
137 9135 walker
		</cite>
138
   					<a class="btn" id="downloadPackage">
139 7985 leinfelder
   						<xsl:attribute name="href">
140 8032 leinfelder
							<xsl:value-of select="$packageURI"/><xsl:value-of select="$pid"/>
141 7985 leinfelder
						</xsl:attribute>
142 8083 leinfelder
   						Download <i class="icon-arrow-down"></i>
143 7985 leinfelder
   					</a>
144 9135 walker
   		<div id="downloadContents"></div>
145 7985 leinfelder
146 7982 leinfelder
   </xsl:template>
147
148
   <!--************** creates lsid dataset id **************-->
149
   <xsl:template name="lsid">
150
		<xsl:variable name="lsidString1" select="concat('urn:lsid:',string($lsidauthority),':')"/>
151
		<xsl:variable name="lsidString2" select="concat($lsidString1, substring-before(string(../@packageId),'.'), ':')"/>
152
		<xsl:variable name="lsidString3" select="concat($lsidString2, substring-before(substring-after(string(../@packageId),'.'),'.'), ':')"/>
153
		<xsl:variable name="lsidString4" select="concat($lsidString3, substring-after(substring-after(string(../@packageId),'.'),'.'))"/>
154
		<xsl:value-of select="$lsidString4"/>
155
   </xsl:template>
156
157
   <!--************** creates citation for a creator in "Last FM" format **************-->
158
   <xsl:template name="creatorCitation">
159
	   	<xsl:for-each select="individualName">
160
161
	   		<xsl:value-of select="surName/text()"/>
162
	   		<xsl:text> </xsl:text>
163
164
	   		<xsl:for-each select="givenName">
165
	   			<xsl:value-of select="substring(string(.),1,1)"/>
166
	   		</xsl:for-each>
167
	   	</xsl:for-each>
168
169
	   	<!-- only show organization if the person is omitted  -->
170
	   	<xsl:if test="string(individualName/surName) = ''">
171
		   	<xsl:for-each select="organizationName">
172
		   		<xsl:value-of select="."/>
173
		   	</xsl:for-each>
174
	   	</xsl:if>
175
176
   </xsl:template>
177
178
 </xsl:stylesheet>