I have an Excel XML worksheet that contains
<Cell ss:StyleID="s127"><Data ss:Type="String">Replace Me</Data></Cell>
I want to replace @ A01-Replace with another line. I use the XQuery replacement function as follows:
let $excel := doc("document.xml")
let $test := "another string"
return replace($excel, "Replace Me", $test)
Before calling replace, the $ excel variable is valid for XML after output. However, when I print $ excel after calling the replace function, all the XML tags have been removed, and $ excel is a string with the contents of the cells as values. I would like to save XML tags there.
I expect
<Cell ss:StyleID="s127"><Data ss:Type="String">another string</Data></Cell>
However i get
another string
All XML tags are deleted.
Any ideas?
source
share