Project

General

Profile

1
<?xml version="1.0"?>
2
<xsl:stylesheet 
3
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
4
    xmlns:gmd="http://www.isotc211.org/2005/gmd" 
5
    xmlns:gco="http://www.isotc211.org/2005/gco" version="1.0">
6
    <xsl:import href="iso-md.xsl"/>
7
    <xsl:import href="iso-ci.xsl"/>
8
    <xsl:import href="iso-ex.xsl"/>
9
    <xsl:import href="iso-gco.xsl"/>
10
    <xsl:import href="iso-gmd.xsl"/>
11
    <xsl:import href="iso-gml.xsl"/>
12
    <xsl:import href="iso-gmx.xsl"/>
13
    <xsl:output method="html" encoding="UTF-8" doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN" doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" indent="yes" />
14
    <xsl:template match="*[local-name()='MD_Metadata'] | *[local-name()='MI_Metadata']">
15
        <form class="form-horizontal">
16
            <div class="control-group entity">
17
                <h4>General</h4>
18
                <!-- fileIdentifier 0:1 -->
19
                <xsl:if test="./gmd:fileIdentifier and normalize-space(./gmd:fileIdentifier/text())!=''">
20
                    <div class="control-group">
21
                        <label class="control-label">File Identifier</label>
22
                        <div class="controls">
23
                            <div class="controls-well">
24
                                <xsl:apply-templates select="./gmd:fileIdentifier" />
25
                            </div>
26
                        </div>
27
                    </div>
28
                </xsl:if>
29
                <!-- TODO: language 0:1 -->
30
                <!-- TODO: characterSet 0:1 -->
31
                <!-- Parent Identifier 0:1 -->
32
                <xsl:if test="./gmd:parentIdentifier and normalize-space(./gmd:parentIdentifier/text())!=''">
33
                    <div class="control-group">
34
                        <label class="control-label">Parent Identifier</label>
35
                        <div class="controls">
36
                            <div class="controls-well">
37
                                <xsl:apply-templates select="./gmd:parentIdentifier" />
38
                            </div>
39
                        </div>
40
                    </div>
41
                </xsl:if>
42
                <!-- TODO: hierarchyLevel 0:∞ -->
43
                <!-- TODO: hierarchyLevelName 0:∞ -->
44
                <!-- Alternate identifier(s) 0:∞-->
45
                <!-- gmd:identifier is an optional part of the CI_Citation element -->
46
                <xsl:for-each select="./gmd:identificationInfo/gmd:MD_DataIdentification/gmd:citation/gmd:CI_Citation/gmd:identifier">
47
                    <xsl:if test="normalize-space(.//gmd:code/gco:CharacterString/text())!=''">
48
                        <div class="control-group">
49
                            <label class="control-label">Cited Identifier</label>
50
                            <div class="controls">
51
                                <div class="controls-well">
52
                                    <xsl:variable name="code">
53
                                        <xsl:value-of select=".//gmd:code/gco:CharacterString/text()" />
54
                                    </xsl:variable>
55
                            
56
                                    <xsl:choose>
57
                                        <xsl:when test="starts-with($code, 'http')">
58
                                            <xsl:element name="a">
59
                                                <xsl:attribute name="href">
60
                                                    <xsl:value-of select="$code" />
61
                                                </xsl:attribute>
62
                                                <xsl:value-of select="$code" />
63
                                            </xsl:element>
64
                                        </xsl:when>
65
                                        <xsl:otherwise>
66
                                            <xsl:value-of select="$code" />
67
                                        </xsl:otherwise>
68
                                    </xsl:choose>
69
                                </div>
70
                            </div>
71
                        </div>
72
                    </xsl:if>
73
                </xsl:for-each>
74
                
75
                <!-- Abstract 0:∞  Only shown if the abstract has content -->
76
                <xsl:for-each select="./gmd:identificationInfo/gmd:MD_DataIdentification/gmd:abstract">
77
                    <xsl:if test="normalize-space(./gco:CharacterString/text()) != ''">
78
                        <div class="control-group">
79
                            <label class="control-label">Abstract</label>
80
                            <div class="controls">
81
                                <div class="controls-well">
82
                                    <xsl:apply-templates />
83
                                </div>
84
                            </div>
85
                        </div>
86
                    </xsl:if>
87
                </xsl:for-each>
88
                <!-- Purpose 0:∞ -->
89
                <xsl:for-each select="./gmd:identificationInfo/gmd:MD_DataIdentification/gmd:purpose">
90
                    <xsl:if test="normalize-space(./gco:CharacterString/text()) != ''">
91
                        <div class="control-group">
92
                            <label class="control-label">Purpose</label>
93
                            <div class="controls">
94
                                <div class="controls-well">
95
                                    <xsl:apply-templates />
96
                                </div>
97
                            </div>
98
                        </div>
99
                    </xsl:if>
100
                </xsl:for-each>
101
                <!-- Publication date -->
102
                <xsl:for-each select="./gmd:identificationInfo/gmd:MD_DataIdentification/gmd:citation/gmd:CI_Citation/gmd:date">
103
                    <xsl:if test="./gmd:CI_Date/gmd:dateType/gmd:CI_DateTypeCode/text() = 'publication'">
104
                        <div class="control-group">
105
                            <label class="control-label">Publication Date</label>
106
                            <div class="controls">
107
                                <div class="controls-well">
108
                                    <xsl:apply-templates select="./gmd:CI_Date/gmd:date" />
109
                                </div>
110
                            </div>
111
                        </div>
112
                    </xsl:if>
113
                </xsl:for-each>
114
                <!-- Status  -->
115
                <xsl:for-each select="./gmd:status">
116
                    <div class="control-group">
117
                        <label class="control-label">Status</label>
118
                        <div class="controls">
119
                            <div class="controls-well">
120
                                <xsl:apply-templates />
121
                            </div>
122
                        </div>
123
                    </div>
124
                </xsl:for-each>
125
                <!-- Topic Categories
126

    
127
                These span multiple MD_DataIdentification Sections so all are
128
                grabbed and rendered in the same place.
129
                -->
130
                <xsl:if test=".//gmd:topicCategory">
131
                    <div class="control-group">
132
                        <label class="control-label">Topic Categories</label>
133
                        <div class="controls">
134
                            <div class="controls-well">
135
                                <table class="table table-condensed">
136
                                    <thead>
137
                                        <tr>
138
                                            <th>Topic</th>
139
                                        </tr>
140
                                    </thead>
141
                                    <tbody>
142
                                        <xsl:for-each select=".//gmd:topicCategory">
143
                                            <tr>
144
                                                <td>
145
                                                    <xsl:apply-templates />
146
                                                </td>
147
                                            </tr>
148
                                        </xsl:for-each>
149
                                    </tbody>
150
                                </table>
151
                            </div>
152
                        </div>
153
                    </div>
154
                </xsl:if>
155
                <!-- Keywords
156

    
157
                These span multiple MD_DataIdentification Sections so all are
158
                grabbed and rendered in the same place.
159

    
160
                Each <gmd:descriptiveKeywords> block should have one or more keywords in it
161
                with one thesaurus. So we render keywords from the same thesaurus together.
162
                -->
163
                <xsl:if test="//gmd:descriptiveKeywords">
164
                    <div class="control-group">
165
                        <label class="control-label">Descriptive Keywords</label>
166
                        <div class="controls">
167
                            <div class="controls-well">
168
                                <xsl:for-each select="//gmd:descriptiveKeywords">
169
                                    <xsl:apply-templates />
170
                                </xsl:for-each>
171
                            </div>
172
                        </div>
173
                    </div>
174
                </xsl:if>
175
            </div>
176
            <div class="control-group entity">
177
                <h4>People and Associated Parties</h4>
178
                <!-- Metadata Contact(s) 1:inf -->
179
                <div class="control-group">
180
                    <label class="control-label">Metadata Contacts</label>
181
                    <div class="controls">
182
                        <div class="controls-well">
183
                            <xsl:for-each select="./gmd:contact">
184
                                <xsl:apply-templates />
185
                            </xsl:for-each>
186
                        </div>
187
                    </div>
188
                </div>
189
                <!-- Data Set Contact(s) -->
190
                <div class="control-group">
191
                    <label class="control-label">Data Set Contacts</label>
192
                    <div class="controls">
193
                        <div class="controls-well">
194
                            <xsl:apply-templates select="./gmd:identificationInfo/gmd:MD_DataIdentification/gmd:pointOfContact" />
195
                        </div>
196
                    </div>
197
                </div>
198
                <!-- Cited responsible parties-->
199
                <div class="control-group">
200
                    <label class="control-label">Responsible Parties</label>
201
                    <div class="controls">
202
                        <div class="controls-well">
203
                            <xsl:apply-templates select="./gmd:identificationInfo/gmd:MD_DataIdentification/gmd:citation/gmd:CI_Citation/gmd:citedResponsibleParty" />
204
                        </div>
205
                    </div>
206
                </div>
207
            </div>
208
            <!-- Extent (geographic, temporal, vertical) -->
209
            <xsl:for-each select="./gmd:identificationInfo/gmd:MD_DataIdentification/gmd:extent">
210
                <xsl:apply-templates />
211
            </xsl:for-each>
212
            <xsl:if test=".//gmd:metadataConstraints">
213
                <div class="control-group entity">
214
                    <h4>Metadata Constraints</h4>
215
                    <xsl:for-each select=".//gmd:metadataConstraints">
216
                        <xsl:apply-templates />
217
                    </xsl:for-each>
218
                </div>
219
            </xsl:if>
220
            <xsl:if test=".//gmd:resourceConstraints">
221
                <div class="control-group entity">
222
                    <h4>Resource Constraints</h4>
223
                    <xsl:for-each select=".//gmd:resourceConstraints">
224
                        <xsl:apply-templates />
225
                    </xsl:for-each>
226
                </div>
227
            </xsl:if>
228
            <xsl:if test=".//gmd:supplementalInformation">
229
                <div class="control-group entity">
230
                    <h4>Supplemental Information</h4>
231
                    <xsl:for-each select=".//gmd:supplementalInformation">
232
                        <xsl:apply-templates />
233
                    </xsl:for-each>
234
                </div>
235
            </xsl:if>
236
        </form>
237
    </xsl:template>
238
    <!-- General, high-level templates -->
239
    <!-- TODO: Figure out how to do this: I want to capture the scenario where
240
    an element like gmd:individualName has no child gco:CharacterString or
241
    equivalent but has a nilReason attribute. -->
242
    <xsl:template match="*[not(*) and ./@nilReason]">
243
        <xsl:value-of select="@nilReason" />
244
    </xsl:template>
245
</xsl:stylesheet>
(8-8/8)