Xquery值的总和

时间:2017-01-22 17:14:48

标签: sum xquery xquery-3.0

我有这部分代码:

<recipe>
{ for $r in doc("retete.xml")//recipe
return <rec title="{$r/title}">{
<item>{
    for $r3 in doc("listaPreturi.xml")//produs
    for $r2 in $r/ingredients/ingredient
    where $r2/@name = $r3/@denumire
    return <it>{$r3/pret * $r2/@amount / $r3/pret/@cantitate}</it>
}
</item>
}</rec>}
</recipe>

结果就是这个

<recipe>
 <rec title="Pui la cuptor">
   <item>
     <it>1550</it>
     <it>250</it>
  </item>
</rec>
<rec title="Curcan la cuptor">
  <item>
     <it>1550</it>
     <it>1889.9999999999998</it>
    </item>
  </rec>
</recipe>

如何为每个<it><item>添加相同的函数值?

0 个答案:

没有答案