for $x at $count in file:list($path)
order by $x descending
return
if (file:is-dir($path||'/'||$x))
then
let $s := count(analyze-string($path||$x,'/')//fn:match)
return
<zip:dir name = "{replace($x,'/$','')}">
{local:mapp($path||'/'||$x,$s)}
</zip:dir>
else
<zip:entry name="{$x}" src="{$path}/{$x}"/>
};
for $x in file:read-text-lines('liste.txt')
return
copy $doc := doc("/document.xml")
modify
for $w in $doc//w:t[.//text() contains text 'XXXXX'] return
replace value of node $w with replace($w,'XXXXX',$x)
return
(
file:write("document.xml",$doc)
,
let $rep := "/docx"
let $dest := "/tmp"
return
zip:zip-file(
{local:mapp($rep,1)}
</file>)
)