0
在下面的XQuery一切正常,只是在該線下方,上面寫着:金額超過一個百萬顯示奇怪的是使用XQuery
<h2>Total word count: {format-number($sum, "0")}</h2>
如果總和超過一百萬的它顯示爲:
「1.516908E6」
我不明白這個數字。例如,爲什麼會有「E」?
任何低於百萬次打印預期,例如:
「72188」 爲72188。
我可能缺少一些基本的東西,但我會很感激任何幫助。
開始的XQuery
xquery version "3.0";
declare namespace tei="http://www.tei-c.org/ns/1.0";
declare option exist:serialize "method=html media-type=text/html ident=no";
let $commentaryid := request:get-parameter('commentaryid', '')
let $collection := concat("scta", "/", $commentaryid)
let $terms :=
<terms>
{
util:index-keys(
collection(concat("/db/apps/", $collection))//tei:p,
"",
function($key, $count) {
<term name="{$key}" count="{$count[1]}"
docs="{$count[2]}"/>
}, -1, "lucene-index")
}
</terms>
let $sum := sum($terms//@count)
return
<html>
<head>
</head>
<body>
<h1>Frequency analysis for {$collection}</h1>
<h2>Total word count: {format-number($sum, "0")}</h2>
<table>
<tr>
<td>Term</td>
<td>Frequency</td>
<td>Percentage</td>
</tr>
{
for $term in $terms//term
let $frequency := xs: integer($term/@count/string())
let $percentage := format-number(($term/@count div $sum), "%.00")
order by $frequency descending
return
<tr>
<td>{$term/@name/string()}</td>
<td>{$frequency}</td>
<td>{$percentage}%</td>
</tr>
}
</table>
</body>
</html>
爲了確認,我假設你使用'util:index-keys()'表示你的XQuery實現是eXist。你使用的是什麼版本的eXist? – joewiz
嗨@joewiz,我正在運行3.0.RC1 – Jeff
https://en.m.wikipedia.org/wiki/Scientific_notation#E_notation – har07