Skip to content

Commit bf48bb7

Browse files
ryanjdewMarkLogic Builder
authored andcommitted
DHFPROD-8856: Handle empty sequences from merge
1 parent 3b39dfb commit bf48bb7

File tree

1 file changed

+10
-6
lines changed
  • marklogic-data-hub/src/main/resources/ml-modules/root/com.marklogic.smart-mastering/survivorship/merging

1 file changed

+10
-6
lines changed

marklogic-data-hub/src/main/resources/ml-modules/root/com.marklogic.smart-mastering/survivorship/merging/base.xqy

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1451,18 +1451,22 @@ declare function merge-impl:generate-path-templates($path-properties as map:map*
14511451
let $values := if ($wrap-in-array) then array-node {$values} else $values
14521452
return
14531453
typeswitch($values)
1454+
case empty-sequence() return
1455+
()
14541456
(: Convert JSON nodes to the serialized JSON elements :)
14551457
case array-node()|object-node() return
14561458
xdmp:from-json($values)
14571459
(: JSON specific leaf nodes can't be added directly added to XSLT :)
14581460
default return
14591461
let $data-value := fn:data($values)
1460-
let $data-type := xdmp:type($data-value)
1461-
where $data-type = xs:QName("xs:boolean") or fn:number($data-type) = 0 or $data-value
1462-
return (
1463-
<xsl:attribute name="xsi:type">{$data-type}</xsl:attribute>,
1464-
$data-value
1465-
)
1462+
where fn:exists($data-value)
1463+
return
1464+
let $data-type := xdmp:type($data-value)
1465+
where $data-type = xs:QName("xs:boolean") or fn:number($data-type) = 0 or $data-value
1466+
return (
1467+
<xsl:attribute name="xsi:type">{$data-type}</xsl:attribute>,
1468+
$data-value
1469+
)
14661470
}
14671471
</xsl:copy>
14681472
</xsl:template>

0 commit comments

Comments
 (0)