【发布时间】:2010-05-25 01:30:19
【问题描述】:
我有一个 XML 格式的 Excel 工作表,其中包含
<Cell ss:StyleID="s127"><Data ss:Type="String">Replace Me</Data></Cell>
我想用不同的字符串替换@A01-Replace。我正在使用 XQuery 的替换功能,如下所示:
let $excel := doc("document.xml")
let $test := "another string"
return replace($excel, "Replace Me", $test)
在调用 replace 之前,变量 $excel 在输出时是有效的 XML。但是,当我在调用 replace 函数后输出 $excel 时,所有 XML 标记都已被剥离,并且 $excel 是一个以单元格内容作为其值的字符串。我想将 XML 标记保留在那里。
我期待的是
<Cell ss:StyleID="s127"><Data ss:Type="String">another string</Data></Cell>
但是,我明白了
another string
所有的 XML 标签都被去掉了。
有什么想法吗?
【问题讨论】: