我希望通过使用映射的键和值对来实现对文档中的字符串的查找和替换。由于 2 个映射值,我目前拥有的代码似乎返回了 2 个字符串。我希望返回一个字符串,其中大括号中的值被映射中的值替换。
let $text:='On ${date} the value of alert is ${alerts}'
let $params:= map:map()
let $noop:=map:put($params,'date','TESTINGDATE')
let $noop:=map:put($params,'alerts','TESTALERT')
let $formatted-message:=for $keys in map:keys($params)
let $message:=fn:replace($text,fn:concat('\$\{',$keys,'\}'),map:get($params,$keys))
return $message
return $formatted-message