From bf8cba31b29bfefda48a4384b6e32da2e8c44138 Mon Sep 17 00:00:00 2001 From: Bpolitycki Date: Wed, 6 Dec 2023 10:44:51 +0100 Subject: [PATCH] Fix recursive template execution for child nodes --- content/templates.xqm | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/content/templates.xqm b/content/templates.xqm index 3c7184e..47c2108 100644 --- a/content/templates.xqm +++ b/content/templates.xqm @@ -146,14 +146,18 @@ declare function templates:process($nodes as node()*, $model as map(*)) { return templates:call($instruction, $node, $model) else - element { node-name($node) } { - $node/@*, for $child in $node/node() return templates:process($child, $model) - } - else $node + templates:process-childs($node, $model) + else templates:process-childs($node, $model) default return $node }; +declare %private function templates:process-childs($node as node(), $model as map(*)) { + element { node-name($node) } { + $node/@*, for $child in $node/node() return templates:process($child, $model) + } +}; + declare %private function templates:get-instructions($class as xs:string?) as xs:string* { for $name in tokenize($class, "\s+") where templates:is-qname($name)