开发者

how to iterate through tokenize result in xquery

开发者 https://www.devze.com 2023-04-01 17:24 出处:网络
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 stri

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

精彩评论

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