Skip to content

Commit

Permalink
marklogic-community#333 fix syntax error in xdmp:unpath call
Browse files Browse the repository at this point in the history
arises when entity definition has a flat stucture - existing code
strips out the last path component resulting in an empty path being
passed to xdmp:unpath
  • Loading branch information
creanjx committed Sep 27, 2019
1 parent 04c9bb9 commit e53b8f6
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -1575,7 +1575,12 @@ declare function merge-impl:get-instance-props-by-path(
let $inst-path := merge-impl:strip-top-path($path-prop/@path)
let $parts := fn:tokenize($inst-path, "/")
(: We'll grab the node above our target so that we determine whether it's an array :)
let $middle-path := fn:string-join($parts[fn:position() != fn:last()], "/")

(:Issue #333 WORKAROUND:)
let $middle-path := if (fn:count($parts) eq 1) then $parts[fn:last()]
else fn:string-join($parts[fn:position() != fn:last()], "/")
(:Issue #333 END OF WORKAROUND:)

let $target-name-str := $parts[fn:last()]
let $target-name := fn:QName(map:get($ns-map, fn:replace($target-name-str, ":.*", "")), $target-name-str)
return (
Expand Down

0 comments on commit e53b8f6

Please sign in to comment.