Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/svg/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Svg BaseX中属性的多次更新_Svg_Xquery_Basex_Xquery Update - Fatal编程技术网

Svg BaseX中属性的多次更新

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

我正在尝试更新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 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"/>