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>
精彩评论