計算平均我有一個這樣的XML文件:的Xquery的屬性
<?xml version="1.0" encoding="ISO-8859-1" ?>
<?xml-stylesheet href="class3.xsl" type="text/xsl" ?>
<school>
<student><name>Jack T</name>
<course title="INF8430" note="78" />
<course title="INF1030" note="69" />
<course title="INF1230" note="85" /></student>
<student><name>Marty L</name>
<course title="INF8430" note="95" />
<course title="INF1030" note="82" />
<course title="INF1230" note="77" /></student>
<student><name>Ben L</name>
<course title="INF9430" note="59" />
<course title="INF1030" note="78" />
<course title="INF1230" note="79" /></student>
</school>
在我的XQuery我用這個:
{
for $s in distinct-values(doc("class3.xml")//course/@title)
return
<course title="{$s}">
</course>
}
我試圖讓每個平均不同的標題。 我得到正確的標題,但我怎麼能算平均? 我嘗試了很多東西之間的課程標籤找到平均,有人可以幫助我 謝謝
太棒了,到底需要什麼。在我之前完成的所有測試中,我錯過了[@ title = s $]的部分,現在我明白了。謝謝馬修 – baronming