|
151 | 151 |
|
152 | 152 | --> |
153 | 153 |
|
| 154 | + <xsl:template mode="mode-iso19139" |
| 155 | + match="gml320:TimeInstant[gml320:timePosition]|gml:TimeInstant[gml:timePosition]" |
| 156 | + priority="50000"> |
| 157 | + |
| 158 | + <xsl:variable name="configName" select="concat(local-name(..),'Position')"/> |
| 159 | + <!-- 'temporalRangeSection' this is the name of the section (defined elsewhere) |
| 160 | + and uses to find the translated tag for the section in the UI --> |
| 161 | + <xsl:variable name="translation" |
| 162 | + select="$strings/*[name() = $configName]"/> |
| 163 | + <xsl:variable name="name" |
| 164 | + select="if ($translation != '') |
| 165 | + then $translation |
| 166 | + else $configName"/> |
| 167 | + |
| 168 | + <xsl:variable name="id" select="concat('_X', gn:element/@ref, '_replace')"/> |
| 169 | + |
| 170 | + <xsl:variable name="isFirst" select="position() = 1"/> |
| 171 | + <xsl:variable name="originalNode" |
| 172 | + select="gn-fn-metadata:getOriginalNode($metadata, .)"/> |
| 173 | + <xsl:variable name="del" select="./@del"/> |
| 174 | + |
| 175 | + <xsl:variable name="refToDelete"> |
| 176 | + <xsl:call-template name="get-ref-element-to-delete"> |
| 177 | + <xsl:with-param name="node" select="$originalNode"/> |
| 178 | + <xsl:with-param name="delXpath" select="$del"/> |
| 179 | + </xsl:call-template> |
| 180 | + </xsl:variable> |
| 181 | + |
| 182 | + <xsl:variable name="parent_parent" select="."/> |
| 183 | + |
| 184 | + <!-- look at the actual XML's gml namespace URI |
| 185 | + if its GML 32, then that matches most of the implicit |
| 186 | + assumptions inside GN. Especially the JS, which assumes that |
| 187 | + an element with a "gml:" prefix is GML 3.2. |
| 188 | + However, this is a really bad assumption - all the iso19139 sample data |
| 189 | + has "gml:" as the old (NOT GML 3.2). |
| 190 | + Also, in this XSLT; |
| 191 | + "gml:" - version 3.2 |
| 192 | + "gml320:" - OLD VERSION (!!!!!!!!) |
| 193 | + --> |
| 194 | + <xsl:variable name="element_ns_uri" select="namespace-uri()"/> |
| 195 | + <xsl:variable name="element_ns_prefix" select="prefix-from-QName(node-name(.))"/> |
| 196 | + <xsl:variable name="gml_is_32" select="$element_ns_uri = 'http://www.opengis.net/gml/3.2'"/> |
| 197 | + <xsl:variable name="timeinstance_id" select="@*[local-name() = 'id']"/> |
| 198 | + |
| 199 | + <xsl:variable name="prefix_to_use">gml</xsl:variable> |
| 200 | + |
| 201 | + <xsl:variable name="prefix_to_use_select"> |
| 202 | + <xsl:choose> |
| 203 | + <xsl:when test="$gml_is_32">gml</xsl:when> |
| 204 | + <xsl:otherwise>gml320</xsl:otherwise> |
| 205 | + </xsl:choose> |
| 206 | + </xsl:variable> |
| 207 | + |
| 208 | + |
| 209 | + <xsl:variable name="label_node" select="local-name(..)"/> |
| 210 | + |
| 211 | + |
| 212 | + <xsl:variable name="template"> |
| 213 | + <template xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:gn="http://www.fao.org/geonetwork" xmlns:gco="http://www.isotc211.org/2005/gco" xmlns:gmd="http://www.isotc211.org/2005/gmd" xmlns:gmx="http://www.isotc211.org/2005/gmx" xmlns:srv="http://www.isotc211.org/2005/srv" xmlns:xlink="http://www.w3.org/1999/xlink"> |
| 214 | + <values> |
| 215 | + <key |
| 216 | + xpath="." |
| 217 | + use="gn-date-picker" |
| 218 | + tooltip="gmd:extent|gmd:EX_TemporalExtent"> |
| 219 | + <xsl:attribute name="label" select="$label_node"/> |
| 220 | + |
| 221 | + <directiveAttributes |
| 222 | + data-assume-gml-ns="true" |
| 223 | + > |
| 224 | + <xsl:attribute name="data-indeterminate-position" select="concat('eval#',$prefix_to_use_select,':timePosition/@indeterminatePosition')"/> |
| 225 | + <xsl:attribute name="data-tag-name" select="concat($prefix_to_use,':timePosition')"/> |
| 226 | + |
| 227 | + </directiveAttributes> |
| 228 | + </key> |
| 229 | + </values> |
| 230 | + <snippet> |
| 231 | + <!-- this is more explicitly done, below --> |
| 232 | + <gml:TimeInstant> |
| 233 | + {{<xsl:copy-of select="local-name(..)"/>}} |
| 234 | + </gml:TimeInstant> |
| 235 | + </snippet> |
| 236 | + </template> |
| 237 | + </xsl:variable> |
| 238 | + |
| 239 | + <xsl:variable name="keyValues"> |
| 240 | + <xsl:call-template name="build-key-value-configuration"> |
| 241 | + <xsl:with-param name="template" select="$template/template"/> |
| 242 | + <xsl:with-param name="currentNode" select="$parent_parent"/> |
| 243 | + <xsl:with-param name="readonly" select="'false'"/> |
| 244 | + </xsl:call-template> |
| 245 | + </xsl:variable> |
| 246 | + |
| 247 | + <xsl:variable name="templateCombinedWithNode" as="node()"> |
| 248 | + <template> |
| 249 | + <xsl:copy-of select="$template/template/values"/> |
| 250 | + |
| 251 | + <xsl:element name="snippet" inherit-namespaces="no"> |
| 252 | + <xsl:attribute name="data-remove-gn-ns-def">true</xsl:attribute> |
| 253 | + |
| 254 | + <xsl:element name="gml:TimeInstant" namespace="{$element_ns_uri}" inherit-namespaces="no"> |
| 255 | + <xsl:attribute namespace="{$element_ns_uri}" name="gml:id"><xsl:value-of select="$timeinstance_id"/></xsl:attribute> |
| 256 | + {{<xsl:copy-of select="local-name(..)"/>}} |
| 257 | + </xsl:element> |
| 258 | + |
| 259 | + |
| 260 | + </xsl:element> |
| 261 | + </template> |
| 262 | + </xsl:variable> |
| 263 | + |
| 264 | + |
| 265 | + <xsl:call-template name="render-element-template-field"> |
| 266 | + <xsl:with-param name="name" select="$name"/> |
| 267 | + <xsl:with-param name="id" select="$id"/> |
| 268 | + <xsl:with-param name="isExisting" select="true()"/> |
| 269 | + <xsl:with-param name="template" select="$templateCombinedWithNode"/> |
| 270 | + <xsl:with-param name="keyValues" select="$keyValues"/> |
| 271 | + <xsl:with-param name="refToDelete" select="$refToDelete/gn:element"/> |
| 272 | + <xsl:with-param name="isFirst" select="$isFirst"/> |
| 273 | + </xsl:call-template> |
| 274 | + </xsl:template> |
| 275 | + |
154 | 276 | <!--- |
155 | 277 | For temporal extent, we want a more complicated control. |
156 | 278 | This will allow the <beginPosition indeterminatePosition="now"></beginPosition> |
|
163 | 285 | This is basically a stand-in for the <field name="temporalRangeSection"> and uses the same template to do the controls. |
164 | 286 | --> |
165 | 287 | <xsl:template mode="mode-iso19139" |
166 | | - match="gmd:MD_Metadata/gmd:identificationInfo/gmd:MD_DataIdentification/gmd:extent/gmd:EX_Extent/gmd:temporalElement" |
| 288 | + match="gmd:MD_Metadata/gmd:identificationInfo/gmd:MD_DataIdentification/gmd:extent/gmd:EX_Extent/gmd:temporalElement[//gml:beginPosition]" |
167 | 289 | priority="30000"> |
168 | 290 | <xsl:variable name="xpath" select="gn-fn-metadata:getXPath(.)"/> |
169 | 291 | <xsl:variable name="isoType" select="if (../@gco:isoType) then ../@gco:isoType else ''"/> |
|
239 | 361 | </xsl:call-template> |
240 | 362 | </xsl:variable> |
241 | 363 |
|
| 364 | + |
242 | 365 | <xsl:variable name="templateCombinedWithNode" as="node()"> |
243 | 366 | <template> |
244 | 367 | <xsl:copy-of select="$template/template/values"/> |
|
268 | 391 | <!-- ===================================================================== --> |
269 | 392 |
|
270 | 393 | <xsl:template mode="mode-iso19139" |
271 | | - match="gml:beginPosition|gml:endPosition|gml:timePosition| |
272 | | - gml320:beginPosition|gml320:endPosition|gml320:timePosition" |
| 394 | + match="gml:beginPosition|gml:endPosition| |
| 395 | + gml320:beginPosition|gml320:endPosition" |
273 | 396 | priority="200"> |
274 | 397 |
|
275 | 398 | <xsl:variable name="xpath" select="gn-fn-metadata:getXPath(.)"/> |
|
0 commit comments