My problem is i want to display the count of all genre that is equals to actions
<videos genre="action" count="{
for $videos in doc("videos.xml")/result/videos/video
let $count := 0
where $videos/genre ="action"
return count($videos/genre)
}"
' '但是我的结果是这个
count is=1 1 1我希望答案等于3
im expecting a result that is
<videos genre="action" count="3"><video>
你把它弄得有点太复杂了;试试这样写:
<videos genre="action" count="{
count(doc("videos.xml")//video[.//genre[.="action"]])
}"/>
或者,根据您实际视频文件的结构,您可以使用
count(//video[.//.="action"])
这些应该可以得到您期望的输出。