Hi, 

I have a process where for each input file, I must create 2 output files. For some reason, I seem to be unable to use more than 1 db:replace in the same function. I have tried pieces of code separately to ensure that every individual piece works. They do work. For your information, I have included my tests as comments after the function. 

(: param $lang is the desired target language of the translation :)
declare %rest:path("/admin/convert-to-xliff")
   %rest:GET
   %rest:query-param("lang", "{$lang}", '')
   updating function admin:convert-to-xliff($lang as xs:string){
     (: Src language is assumed to always be en-us as per business rules:)
     let $src-lang := "en-us"
     for $x in app:open-db($src-lang)
       let $xliff-stylesheet := app:get-translation-xliff-to-xsl()
       let $skeleton-stylesheet := app:get-translation-xliff-skeleton-xsl()
       let $params := map {"lang-to" := $lang}
       let $target-uri := replace(base-uri($x), $src-lang, $lang)
       let $target-skeleton-uri := replace($target-uri, '.xml', '_xliffskeleton.xml')
       let $xliff-doc := xslt:transform($x, $xliff-stylesheet, $params)
       let $xliff-skeleton := xslt:transform($x, $skeleton-stylesheet)
       return db:replace("Translated-units", $target-uri, document{$xliff-doc}), db:replace("Translated-units", $target-skeleton-uri, document {$xliff-skeleton})
};

        (: db:replace("Translated-units", $target-uri, document{$xliff-doc}) --- Creates the expected files in the expected location :)
        (: db:replace("Translated-units", $target-skeleton-uri, document {$xliff-skeleton}) --- Creates the expected files in the expected location :)
        (: concat($target-uri, ' --- ', $target-skeleton-uri) --- remove decl as updating function to test this, both paths are set :)


Any clue? 

Thanks,

France Baril
P.S. I'm using BaseX 7.2.1

--
France Baril
Architecte documentaire / Documentation architect
france.baril@architextus.com
(514) 572-0341