I am looking to implement a find and replace for a string from a document by using the key and value pair of a map. The code I currently have seems to be returning 2 strings because of 2 map values. I am looking to return one string with values in curly braces be replaced by the value in the map.
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