<category>
<catid>1</catid>
<cattext> sport </cattext>
</category>
我想更改元素的文本<cattext>
通过使用 xquery 进入另一个像“艺术”而不是运动
declare namespace local = "http://example.org";
declare function local:copy-replace($element as element()) {
if ($element/self::cattext)
then <cattext>art</cattext>
else element {node-name($element)}
{$element/@*,
for $child in $element/node()
return if ($child instance of element())
then local:copy-replace($child)
else $child
}
};
local:copy-replace(/*)
Output:
<?xml version="1.0" encoding="UTF-8"?>
<category>
<catid>1</catid>
<cattext>art</cattext>
</category>
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)