Skip to content

Commit

Permalink
Editor / Add support for conditional default view
Browse files Browse the repository at this point in the history
When creating an editor configuration with more than one default view an exception is returned.

```
Error on line 82 of edit.xsl:
  XPTY0004: A sequence of more than one item is not allowed as the second argument of concat()
```

Instead, select the first default view defined.

Also add support for conditionally defined default views:

```xml
    <view name="default-for-dataset"
          default="true"
          displayIfRecord="count(//dcat:Catalog/dcat:dataset) > 0">
      <tab id="Dataset" default="true">
        <section name="Dataset info"/>
      </tab>
    </view>
    <view name="default-for-service"
          default="true"
          displayIfRecord="count(//dcat:Catalog/dcat:service) > 0">
      <tab id="Service" default="true">
        <section name="Service info"/>
      </tab>
    </view>
```
  • Loading branch information
fxprunayre authored Dec 10, 2024
1 parent 794db36 commit e6dc12b
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions web/src/main/webapp/xslt/common/base-variables-metadata.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -106,10 +106,11 @@
then /root/request/currTab
else if (/root/gui/currTab != '')
then /root/gui/currTab
else $editorConfig/editor/views/view[@default]/tab[
else ($editorConfig/editor/views/view[@default and
gn-fn-metadata:check-elementandsession-visibility($schema, $metadata, $serviceInfo, @displayIfRecord, @displayIfServiceInfo)]/tab[
@default and
gn-fn-metadata:check-elementandsession-visibility($schema, $metadata, $serviceInfo, @displayIfRecord, @displayIfServiceInfo)
]/@id"/>
]/@id)[1]"/>

<xsl:variable name="viewConfig"
select="$editorConfig/editor/views/view[tab/@id = $tab]"/>
Expand Down

0 comments on commit e6dc12b

Please sign in to comment.