开发者

how to iterate through tokenize result in xquery

In xquery, I have a unknown length string str="/a/b/c" which I can split by tokenize(str, '/'), but what's the syntax to go through all the elements in tokenize result automatically based on string length?

for exam开发者_运维问答ple /a/b/c will be a b c and for /a/b/c/d will be a b c d and so on.


Use a plain old for (FLWOR) loop for this.

<tokens>{
 for $t in tokenize("a/b/c/d/e/f/g","/")
 return <token>{$t}</token>
}</tokens>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜