Svg BaseX中属性的多次更新
我正在尝试更新BaseX中Xquery函数中SVG标记的一些属性。到目前为止,我设法更新了一个属性并返回了新节点,但没有返回多个属性 我尝试了多次更新,作为所述语句的变体,但无论我尝试了什么,它都不起作用Svg BaseX中属性的多次更新,svg,xquery,basex,xquery-update,Svg,Xquery,Basex,Xquery Update,我正在尝试更新BaseX中Xquery函数中SVG标记的一些属性。到目前为止,我设法更新了一个属性并返回了新节点,但没有返回多个属性 我尝试了多次更新,作为所述语句的变体,但无论我尝试了什么,它都不起作用 declare function page:scaleSVG ($svg as node()*, $scale as xs:integer) as node()* { return // update a few values of $svg attributes and return
declare function page:scaleSVG ($svg as node()*, $scale as xs:integer) as node()* {
return // update a few values of $svg attributes and return it
};
上面的函数基本上就是我想要实现的。使用copy/modify/return结构。下面是一个例子:
declare function page:scaleSVG ($svg as node()*, $scale as xs:integer) as node()* {
copy $c := $svg
modify (
replace value of node $c/@width with $scale,
replace value of node $c/@height with $scale
)
return $c
};
那么叫这个,
page:scaleSVG(<svg width="100" height="100" />, 200)
page:scaleSVG(,200)
将返回此文件:
<svg width="200" height="200"/>