且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何使用FLOWR和XQuery创建新的列表项?

更新时间:2023-12-05 15:27:34

如果每个text()都需要一个li,请更改要迭代的内容.而不是在for循环中选择text(),而是遍历每个text():

If you want an li for each of the text(), then alter what you are iterating over. Instead of selecting the text() inside of the for loop, iterate over each of the text():

xquery version "3.0";
declare namespace office="urn:oasis:names:tc:opendocument:xmlns:text:1.0";

<ul>
{
for $foo  in db:open("foo")//text()[not(matches(., '[0-9]'))]
return <li>{$foo}</li>
}
</ul>