Skip to content

Commit

Permalink
Editor / Configuration / Improve deletion in forEach section (geonetw…
Browse files Browse the repository at this point in the history
…ork#8244)

Improve documentation and properly target node to delete in case the
forEach loop element is not the one to remove.

eg.
```xml
<section name="Axe - Time"
         forEach="/mdb:MD_Metadata/mdb:spatialRepresentationInfo/*/msr:axisDimensionProperties/*[msr:dimensionName/*/@codeListValue = 'time']"
         del="ancestor::msr:axisDimensionProperties">
   <field xpath="msr:dimensionSize"/>
   <field xpath="msr:resolution"/>
</section>
```

Before the change, the remove button was not displayed.
Most of the time the loop element is the one to delete and this case was
fine.
  • Loading branch information
fxprunayre authored Jul 10, 2024
1 parent 4618834 commit 9b19b58
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 10 deletions.
16 changes: 9 additions & 7 deletions schemas/config-editor.xsd
Original file line number Diff line number Diff line change
Expand Up @@ -906,7 +906,7 @@ Define if this tab is the default one for the view. Only one tab should be the d
<xs:annotation>
<xs:documentation><![CDATA[
The tab key used in URL parameter to activate that tab. The key is also use for the tab label as defined in ``{schema}/loc/{lang}/strings.xml``.
It has to be unique for all views. A good practice is to use same prefix for all tabs in the same view.
It has to be unique for all views. A good practice is to use same prefix for all tabs in the same view.
]]></xs:documentation>
</xs:annotation>
</xs:attribute>
Expand Down Expand Up @@ -1128,9 +1128,11 @@ Note: Only sections with forEach support del attribute.
<section forEach="/gmd:MD_Metadata/gmd:distributionInfo">
<text><h2>Distribution</h2></text>
<section forEach="*/gmd:transferOptions/*/gmd:onLine/gmd:CI_OnlineResource" name="A link">
<field xpath="gmd:linkage"/>
<field xpath="gmd:name" or="name" in="."/>
<section forEach="*/gmd:transferOptions/*/gmd:onLine"
name="A link"
del=".">
<field xpath="*/gmd:linkage"/>
<field xpath="*/gmd:name" or="name" in="."/>
</section>
<text><hr/></text>
</section>
Expand Down Expand Up @@ -2111,9 +2113,9 @@ An autocompletion list based on a thesaurus.
This field facilitates users in selecting a `subtemplate` (also known as xml-snippet) from the catalogue. Subtemplates are mostly used to store contact details,
but can also be used to store snippets of xml having Quality reports, Access constraints, CRS definitions, etc.
`data-insert-modes` can be `text` and/or `xlink` depending on how the subtemplate is encoded.
Contact can be forced to be `xlink` but some other type of subtemplates (eg. DQ report) are usually just simple default values
`data-insert-modes` can be `text` and/or `xlink` depending on how the subtemplate is encoded.
Contact can be forced to be `xlink` but some other type of subtemplates (eg. DQ report) are usually just simple default values
that need to be detailed by editors and in that case `text` mode is recommended. For `xlink`, the XLink resolver needs to be enabled in the admin settings.
Expand Down
6 changes: 3 additions & 3 deletions web/src/main/webapp/xslt/ui-metadata/form-configurator.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -151,15 +151,15 @@
<xsl:variable name="originalNode"
select="gn-fn-metadata:getOriginalNode($metadata, .)"/>

<xsl:variable name="refToDelete">
<xsl:variable name="refToDelete" as="node()?">
<xsl:call-template name="get-ref-element-to-delete">
<xsl:with-param name="node" select="$originalNode"/>
<xsl:with-param name="delXpath" select="$del"/>
</xsl:call-template>
</xsl:variable>

<xsl:call-template name="render-form-field-control-remove">
<xsl:with-param name="editInfo" select="gn:element"/>
<xsl:with-param name="editInfo" select="$refToDelete"/>
</xsl:call-template>
</xsl:if>
</legend>
Expand Down Expand Up @@ -329,7 +329,7 @@
select="gn-fn-metadata:check-elementandsession-visibility(
$schema, $base, $serviceInfo, @if, @displayIfServiceInfo)"/>

<!--
<!--
<xsl:message> Field: <xsl:value-of select="@name"/></xsl:message>
<xsl:message>Xpath: <xsl:copy-of select="@xpath"/></xsl:message>
<xsl:message>TemplateModeOnly: <xsl:value-of select="@templateModeOnly"/></xsl:message>
Expand Down

0 comments on commit 9b19b58

Please sign in to comment.