0
考虑以下XQuery代码:的XQuery:令牌化文本,同时保留标签
let $foo := <root>This is a <tag>test</tag>. This is <tag>only</tag> a <tag>test</tag>.</root>
for $s in tokenize($foo, "\. ")
return <sentence>{$s}</sentence>
它返回$foo
分割(很天真)成句子—但它也剔除包含在$foo
标签:
<sentence>this is a test.</sentence>
<sentence>this is only a test.</sentence>
假设我想分割$foo
为句子,而保留嵌入式标签,给出的输出如下所示:
<sentence>this is a <tag>test</tag>.</sentence>
<sentence>this is <tag>only</tag> a <tag>test</tag>.</sentence>
我应该如何处理这个问题?