Hi Everyone,
I'm migrating a webapp from BaseX 9.7 to BaseX 11 and I'm having a problem with a wrapper function (just a function for adding content to an xml template file)
Basically, this function looks for nodes in a template.xml file that matche regex to update the content of this file. Here is a small example :
template.xml <foo> <bar>{content}</bar> </foo>
Query: let $file := 'template.xml' let $wrap := fn:doc($file) let $regex := '{(.+?)}’ (: looking for something between curly braces :)
return for $node in $data//* where $node[fn:matches(text(), $regex)] return $node
This function worked with BaseX 9.7, but returns an error with BaseX 11 : [XPTY0004] Item expected, sequence found: ("
 ", "
").
However, if I put the content of template.xml in a variable, it works (even with BaseX 11): let $wrap := <foo> <bar>{{content}}</bar> (: just escaped curly braces :) </foo> let $regex := '{(.+?)}'
return for $node in $wrap//* where $node[fn:matches(text(), $regex)] return $node (:<bar>{content}</bar>:)
Do you have any idea of what I'm doing wrong or what I’m missing?
Thanks for your help! Best, Josselin