我试过下面提到的 XQuery 。
declare variable $path as xs:string :="D:\Mongo\";
let $uri :="/MJ/1932/Vol1/Part1/387.xml"
let $x := fn:normalize-space(fn:replace($uri,"/"," "))
for $i in fn:tokenize($x, " ")
let $j := fn:concat($path,$i)
return($j)
实际输出
D:\Mongo\MJ
D:\Mongo\1932
D:\Mongo\Vol1
D:\Mongo\Part1
D:\Mongo\387.xml
预期产出
D:\Mongo\MJ
D:\Mongo\MJ\1932
D:\Mongo\MJ\1932\Vol1
D:\Mongo\MJ\1932\Vol1\Part1
D:\Mongo\MJ\1932\Vol1\Part1\387.xml
请建议我,如何更改动态变量值。