我试图一次显示三个不同的变量。 这是我尝试过的。
let $totalmovies := count(//Movies/Movie)
let $averagevariton:=(count(//Movies/Movie/secondtitles/OtherTitleName) + count(//Movies/Movie/Title) ) div $totalmovies
for $m in //Movies/Movie
let $year := (max($m/secondtitles/Year) - min($m/secondtitles/Year))+1
order by $year descending
return ($totalmovies,$averagevariton,$year)
但此刻,它会继续打印值,直到循环完成。如何只显示一次这些值?
答案 0 :(得分:0)
不清楚正确的输出应该是什么,也许您只想使用for
循环来填充$year
变量,如下所示:
let $totalmovies := count(//Movies/Movie)
let $averagevariton:= (count(//Movies/Movie/secondtitles/OtherTitleName) + count(//Movies/Movie/Title) ) div $totalmovies
let $year :=
for $m in //Movies/Movie
let $diff := (max($m/secondtitles/Year) - min($m/secondtitles/Year))+1
order by $diff descending
return $diff
return ($totalmovies,$averagevariton,$year)