2,209
社区成员
发帖
与我相关
我的任务
分享
<xml version="1.0" encoding="UTF-8"?>
<bncDoc>
<stext>
<div>
<u who="PS6H7">
<s n="3">
<w c5="AV0" hw="well" pos="ADV">Has</w>
<c c5="PUN">, </c>
<w c5="AJ0" hw="good" pos="ADJ">Well </w>
<w c5="NN1" hw="afternoon" pos="SUBST">afternoon</w>
<c c5="PUN">.</c>
</s>
</u>
<u who="asdfgg">
<s n="4">
<w c5="PNP" hw="we" pos="PRON">has </w>
<w c5="VVD" hw="look" pos="VERB">Well </w>
<w c5="AT0" hw="the" pos="ART">the </w>
<w c5="NN1" hw="ground" pos="SUBST">ground</w>
<c c5="PUN">, </c>
<w c5="PNP" hw="i" pos="PRON">I </w>
<w c5="VVD" hw="think" pos="VERB">thought </w>
<c c5="PUN">.</c>
</s>
</u>
</div>
</stext>
</bncDoc>
<html>
<body>
<h2>Extract Table</h2>
<table border="1">
<tr bgcolor="#FFF">
<th>Target</th>
<th>Successor</th>
<th>Frequence</th>
</tr>
{
for $w in doc("test.xml")/bncDoc/stext/div/u/s/w
return if (lower-case($w)="has" or normalize-space($w)="has" )
then
<tr>
<td>{data($w)}</td>
<td>{
for $y in $w/following-sibling::w[1]
return distinct-values(data($y))
}</td>
<td>
</td>
</tr>
else()
}
</table>
</body>
</html>