Project

General

Profile

1 10046 mecum
<?xml version="1.0"?>
2
<xsl:stylesheet
3 10159 mecum
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
4
    xmlns:gmd="http://www.isotc211.org/2005/gmd"
5 10385 mecum
    xmlns:gco="http://www.isotc211.org/2005/gco" version="1.0">
6 10159 mecum
    <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 10385 mecum
    <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 10159 mecum
    <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 10385 mecum
                <!-- fileIdentifier 0:1 -->
19 10418 mecum
                <xsl:if test="./gmd:fileIdentifier and normalize-space(./gmd:fileIdentifier/text())!=''">
20 10385 mecum
                    <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 10159 mecum
                        </div>
27
                    </div>
28 10385 mecum
                </xsl:if>
29
                <!-- TODO: language 0:1 -->
30
                <!-- TODO: characterSet 0:1 -->
31
                <!-- Parent Identifier 0:1 -->
32 10418 mecum
                <xsl:if test="./gmd:parentIdentifier and normalize-space(./gmd:parentIdentifier/text())!=''">
33 10159 mecum
                    <div class="control-group">
34
                        <label class="control-label">Parent Identifier</label>
35
                        <div class="controls">
36
                            <div class="controls-well">
37 10174 mecum
                                <xsl:apply-templates select="./gmd:parentIdentifier" />
38 10159 mecum
                            </div>
39
                        </div>
40
                    </div>
41
                </xsl:if>
42 10385 mecum
                <!-- TODO: hierarchyLevel 0:∞ -->
43
                <!-- TODO: hierarchyLevelName 0:∞ -->
44
                <!-- Alternate identifier(s) 0:∞-->
45 10169 mecum
                <!-- gmd:identifier is an optional part of the CI_Citation element -->
46 10385 mecum
                <xsl:for-each select="./gmd:identificationInfo/gmd:MD_DataIdentification/gmd:citation/gmd:CI_Citation/gmd:identifier">
47 10418 mecum
                    <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 10159 mecum
                            </div>
71
                        </div>
72 10418 mecum
                    </xsl:if>
73 10159 mecum
                </xsl:for-each>
74 10418 mecum
75 10385 mecum
                <!-- 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 10383 mecum
                        <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 10159 mecum
                            </div>
85
                        </div>
86 10385 mecum
                    </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 10174 mecum
                <!-- 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 10159 mecum
                    <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 10174 mecum
                                        <xsl:for-each select=".//gmd:topicCategory">
143 10159 mecum
                                            <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 10046 mecum
157 10174 mecum
                These span multiple MD_DataIdentification Sections so all are
158
                grabbed and rendered in the same place.
159
160 10169 mecum
                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 10159 mecum
                <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 10056 mecum
            </div>
176 10159 mecum
            <div class="control-group entity">
177
                <h4>People and Associated Parties</h4>
178
                <!-- Metadata Contact(s) 1:inf -->
179
                <div class="control-group">
180 10385 mecum
                    <label class="control-label">Metadata Contacts</label>
181 10159 mecum
                    <div class="controls">
182
                        <div class="controls-well">
183 10385 mecum
                            <xsl:for-each select="./gmd:contact">
184 10159 mecum
                                <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 10385 mecum
                            <xsl:apply-templates select="./gmd:identificationInfo/gmd:MD_DataIdentification/gmd:pointOfContact" />
195 10159 mecum
                        </div>
196
                    </div>
197
                </div>
198
                <!-- Cited responsible parties-->
199
                <div class="control-group">
200 10418 mecum
                    <label class="control-label">Responsible Parties</label>
201 10159 mecum
                    <div class="controls">
202
                        <div class="controls-well">
203 10385 mecum
                            <xsl:apply-templates select="./gmd:identificationInfo/gmd:MD_DataIdentification/gmd:citation/gmd:CI_Citation/gmd:citedResponsibleParty" />
204 10159 mecum
                        </div>
205
                    </div>
206
                </div>
207
            </div>
208
            <!-- Extent (geographic, temporal, vertical) -->
209 10385 mecum
            <xsl:for-each select="./gmd:identificationInfo/gmd:MD_DataIdentification/gmd:extent">
210 10056 mecum
                <xsl:apply-templates />
211 10159 mecum
            </xsl:for-each>
212 10174 mecum
            <xsl:if test=".//gmd:metadataConstraints">
213
                <div class="control-group entity">
214
                    <h4>Metadata Constraints</h4>
215
                    <xsl:for-each select=".//gmd:metadataConstraints">
216 10159 mecum
                        <xsl:apply-templates />
217
                    </xsl:for-each>
218 10174 mecum
                </div>
219
            </xsl:if>
220
            <xsl:if test=".//gmd:resourceConstraints">
221
                <div class="control-group entity">
222 10385 mecum
                    <h4>Resource Constraints</h4>
223 10174 mecum
                    <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 10159 mecum
        </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 10169 mecum
    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 10159 mecum
        <xsl:value-of select="@nilReason" />
244
    </xsl:template>
245 10385 mecum
</xsl:stylesheet>