I have an XQuery file which returns a huge number of data in the output. I just want to show the first 5 records in my output. Here is the xquery code.
<html> <body> <table border='1'> <tr><td>Target</td><td>Successor</td><td>Probability</td></tr> { let $target := "has" let $occurrences := doc("KS0.xml")//u//s/w[lower-case(normalize-space()) = $target] for $successor in distinct-values($occurrences/following-sibling::w[1]) let $frequency := $occurrences/following-sibling::w[1][. = $successor] let $probability := count($frequency) div count(//u//s/w[lower-case(normalize-space()) = lower-case(normalize-space($successor))]) order by count($frequency) descending return <tr> <td>{$target}</td> <td>{$successor}</td> <td>{$probability}</td> </tr> } </table> </body> </html>
No comments:
Post a Comment