如何在xquery for循环中连接



我找到了解决办法,所以我现在不需要更多的帮助,谢谢大家。问题是,因为我不懂这种语言,嗯。

但需要举个例子所以,花括号是必要的返回{

表示$n在1到10之间(: concatenate something here)

return $something

}

,解决的问题在

下面如何在函数中连接,(最后我用属性来做),但首先我想解决这个

xquery version "1.0-ml";
'use strict';

declare function local:Do_the_string($t as xs:string)  as xs:string{
(:t is wanted node:)

(: below is a temporal loop, I don´t know how to fix it and return concatenated value"
let $test2 := "ll"
let $data := 
for $n in 1 to 10
(: concatenate something here:)

return $n

(: let $row_information := "AAAA2" if I use this line; this works:)  
return $data

};

如果我测试它:

declare function local:Do_the_string($t as xs:string) as xs:string{

ERROR: [1.0-ml] XDMP-AS: (err:XPTY0004) local:Do_the_string("/my/path/test.xml")——无效强制转换:("test21", "test22", "test23",…)as xs:string

#MODIFIED LINEreturn concat ("test2", $n)

我找到了一个解决方案:

返回beginning_html_tag{循环和连接}ending_html_tag

必须使用大括号

xquery version "1.0-ml";
'use strict';
declare function local:Do_the_string($t as xs:string)  as xs:string{

(:let $test2 := $t:)

return <test> {
for $n in 1 to 10

return fn:concat ($n,",")


}</test>
};
let $test as xs:string := ""
let $test :=  local:Do_the_string("what_ever")
return $test


相关内容

  • 没有找到相关文章

最新更新