Project

General

Profile

1
<?xml version="1.0"?>
2
<!--
3
  *  '$RCSfile$'
4
  *    Copyright: 2000 Regents of the University of California and the
5
  *               National Center for Ecological Analysis and Synthesis
6
  *  For Details: http://www.nceas.ucsb.edu/
7
  *
8
  *   '$Author: walker $'
9
  *     '$Date: 2017-03-28 12:55:54 -0700 (Tue, 28 Mar 2017) $'
10
  * '$Revision: 10200 $'
11
  *
12
  * This program is free software; you can redistribute it and/or modify
13
  * it under the terms of the GNU General Public License as published by
14
  * the Free Software Foundation; either version 2 of the License, or
15
  * (at your option) any later version.
16
  *
17
  * This program is distributed in the hope that it will be useful,
18
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
19
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
20
  * GNU General Public License for more details.
21
  *
22
  * You should have received a copy of the GNU General Public License
23
  * along with this program; if not, write to the Free Software
24
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
25
  *
26
  * This is an XSLT (http://www.w3.org/TR/xslt) stylesheet designed to
27
  * convert an XML file that is valid with respect to the eml-variable.dtd
28
  * module of the Ecological Metadata Language (EML) into an HTML format
29
  * suitable for rendering with modern web browsers.
30
-->
31
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
32

    
33
  <xsl:output method="html" encoding="UTF-8"
34
              doctype-public="-//W3C//DTD HTML 4.01 Transitional//EN"
35
              doctype-system="http://www.w3.org/TR/html4/loose.dtd"
36
              indent="yes" />  
37

    
38
   <xsl:template name="nonNumericDomain">
39
     <xsl:param name="nondomainfirstColStyle"/>
40
        <xsl:choose>
41
         <xsl:when test="references!=''">
42
          <xsl:variable name="ref_id" select="references"/>
43
          <xsl:variable name="references" select="$ids[@id=$ref_id]" />
44
          <xsl:for-each select="$references">
45
            <xsl:call-template name="nonNumericDomainCommon">
46
             <xsl:with-param name="nondomainfirstColStyle" select="$nondomainfirstColStyle"/>
47
            </xsl:call-template>
48
          </xsl:for-each>
49
        </xsl:when>
50
        <xsl:otherwise>
51
          <xsl:call-template name="nonNumericDomainCommon">
52
             <xsl:with-param name="nondomainfirstColStyle" select="$nondomainfirstColStyle"/>
53
           </xsl:call-template>
54
        </xsl:otherwise>
55
      </xsl:choose>
56
  </xsl:template>
57

    
58

    
59
  <xsl:template name="nonNumericDomainCommon">
60
    <xsl:param name="nondomainfirstColStyle"/>
61
    <xsl:for-each select="enumeratedDomain">
62
      <xsl:call-template name="enumeratedDomain">
63
        <xsl:with-param name="nondomainfirstColStyle" select="$nondomainfirstColStyle"/>
64
      </xsl:call-template>
65
    </xsl:for-each>
66
    <xsl:for-each select="textDomain">
67
      <xsl:call-template name="enumeratedDomain">
68
        <xsl:with-param name="nondomainfirstColStyle" select="$nondomainfirstColStyle"/>
69
      </xsl:call-template>
70
    </xsl:for-each>
71
  </xsl:template>
72

    
73
  <xsl:template name="textDomain">
74
       <xsl:param name="nondomainfirstColStyle"/>
75
       <p>Text Domain</p>
76
       <div class="control-group">
77
			<label class="control-label">Definition</label>
78
            <div class="controls controls-well">
79
            	<xsl:value-of select="definition"/>
80
            </div>
81
        </div>
82
        <xsl:for-each select="pattern">
83
          <div class="control-group">
84
			<label class="control-label">Pattern</label>
85
            <div class="controls controls-well">
86
            	<xsl:value-of select="."/>
87
            </div>
88
          </div>
89
        </xsl:for-each>
90
        <xsl:if test="source">
91
          <div class="control-group">
92
			<label class="control-label">Source</label>
93
            <div class="controls controls-well">
94
            	<xsl:value-of select="source"/>
95
            </div>
96
          </div>
97
        </xsl:if>
98
  </xsl:template>
99

    
100
  <xsl:template name="enumeratedDomain">
101
     <xsl:param name="nondomainfirstColStyle"/>
102
     <xsl:if test="codeDefinition">
103
        <p>Enumerated Domain</p>
104
        	<thead>
105
        		<tr>
106
        			<th>Code</th>
107
        			<th>Definition</th>
108
        			<th>Source</th>
109
        		</tr>
110
        	</thead>
111
        	<xsl:for-each select="codeDefinition">
112
		      	<tr>
113
					<td class="{$secondColStyle}"><xsl:value-of select="code"/></td>
114
					<td class="{$secondColStyle}"><xsl:value-of select="definition"/></td>
115
					<td class="{$secondColStyle}"><xsl:value-of select="source"/></td>
116
				</tr>
117
			</xsl:for-each>
118
     </xsl:if>
119
     <xsl:if test="externalCodeSet">
120
     	<p>Enumerated Domain (External Set)</p>
121
        <div class="control-group">
122
			<label class="control-label">Set Name</label>
123
			<div class="controls controls-well">
124
				<xsl:value-of select="externalCodeSet/codesetName"/>
125
			</div>
126
		</div>
127
		<div class="control-group">
128
			<label class="control-label">Citation</label>
129
			<div class="controls controls-well">
130
		        <xsl:for-each select="externalCodeSet/citation">
131
		           <xsl:call-template name="citation">
132
		                      <xsl:with-param name="citationfirstColStyle" select="$nondomainfirstColStyle"/>
133
		                   </xsl:call-template>
134
		        </xsl:for-each>
135
	        </div>
136
	    </div>
137
	    <div class="control-group">
138
			<label class="control-label">URL</label>
139
			<div class="controls controls-well"> 
140
		        <xsl:for-each select="externalCodeSet/codesetURL">
141
		        	<a><xsl:attribute name="href"><xsl:value-of select="."/></xsl:attribute><xsl:value-of select="."/></a>
142
		        </xsl:for-each>
143
	        </div>
144
        </div>
145
     </xsl:if>
146
     <xsl:if test="entityCodeList">
147
        <p>Enumerated Domain (Data Object)</p>
148
        <div class="control-group">
149
			<label class="control-label">Data Object Reference</label>
150
            <div class="controls controls-well">
151
            	<xsl:value-of select="entityCodeList/entityReference"/>
152
            </div>
153
		</div>
154
       <div class="control-group">
155
			<label class="control-label">Attribute Value Reference</label>
156
            <div class="controls controls-well">
157
            	<xsl:value-of select="entityCodeList/valueAttributeReference"/>
158
            </div>
159
       </div>
160
       <div class="control-group">
161
			<label class="control-label">Attribute Definition Reference</label>
162
            <div class="controls controls-well">
163
            	<xsl:value-of select="entityCodeList/definitionAttributeReference"/>
164
            </div>
165
       </div>
166
     </xsl:if>
167

    
168
  </xsl:template>
169

    
170

    
171
</xsl:stylesheet>
(3-3/27)