Skip to content

Commit

Permalink
Fix add element attribute in the metadata editor, causing the element…
Browse files Browse the repository at this point in the history
… section is removed from the user interface until the metadata is saved
  • Loading branch information
josegar74 committed Jan 2, 2024
1 parent 6376582 commit 354c1ff
Showing 1 changed file with 22 additions and 1 deletion.
23 changes: 22 additions & 1 deletion web/src/main/webapp/xslt/ui-metadata/edit/edit-embedded.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@

<xsl:template match="/">

<xsl:variable name="snippet">
<xsl:variable name="tempSnippet">
<!-- Process the added object using schema layout ... -->
<xsl:for-each
select="/root/*[name(.)!='gui' and name(.)!='request']//*[@gn:addedObj = 'true']">
Expand All @@ -57,6 +57,27 @@
</xsl:for-each>
</xsl:variable>

<xsl:variable name="snippet">
<xsl:choose>
<xsl:when test="string($tempSnippet)"><xsl:copy-of select="$tempSnippet" /></xsl:when>
<xsl:otherwise>
<!-- If no template defined for the added object, process the parent of the added element using schema layout ... -->
<xsl:for-each
select="/root/*[name(.)!='gui' and name(.)!='request']//*[@gn:addedObj = 'true']">
<!-- Dispatch to profile mode -->
<xsl:variable name="profileTemplate" select="concat('dispatch-', $schema)"/>
<saxon:call-template name="{$profileTemplate}">
<xsl:with-param name="base" select=".."/>
</saxon:call-template>
</xsl:for-each>
</xsl:otherwise>
</xsl:choose>

</xsl:variable>
<xsl:message>
snippet: <xsl:copy-of select="$snippet" />
</xsl:message>

<!-- In case the form generated contains multiple children
element, group them in a container to avoid creation of invalid XML
which will trigger NPE. This may happen if the container element is skipped
Expand Down

0 comments on commit 354c1ff

Please sign in to comment.