Dear BaseX-Team,

I encountered some unexpected behavour, maybe a bug?

I declare a collection of function-signatures.
Then I iterate over the collection inside a copy/modify-construct. Each 
function adds a node to the database.

This works as expected:

declare variable $_:abschlussqueries := (_:f1#2 , _:f2#2);          

declare %updating
     %rest:path('treez/ab4')
function _:abschluss4() as element() {
    <Postabschluss>{ (
        
        try{        
                let $db := doc('FGfax')/Dateien/Datei
                for $d in $db
                return (
                    
                        copy $c := $d
                        modify (
                            for $funct at $counter in $_:abschlussqueries
                            return (
                                (: prof:dump("bla: " || $counter) , :)   
                                prof:void(""),
                                $funct($c, $counter)
                            )
                        )    
                        return (
                            $c                            
                        )  
                )                
               
        } catch * {
                let $db := doc('FGfax')/Dateien
                return
                        error(xs:QName("dieter:norights10"), "Error: "|| 
$err:code || ': ' || $err:description , 418 )
        }
        
    ) }</Postabschluss>
};

declare %updating function _:f1($c, $counter )  {
    
            try {(               
                
filepath:copy-to("C:\Users\Win7ProUser\Documents\FGscan_ScanDocs\bla.xml","C:\Users\Win7ProUser\Documents\FGscan_ScanDocs\bla1.xml"),
                insert node <f1>function1 </f1> as last into $c                 
              
            )} catch * {                
                insert node <f1>{"Error: "|| $err:code || ': ' || 
$err:description}</f1> as last into $c                
            }
};

declare %updating function _:f2($c, $counter )  {
   
            try {(               
                
filepath:copy-to("C:\Users\Win7ProUser\Documents\FGscan_ScanDocs\bla.xml","C:\Users\Win7ProUser\Documents\FGscan_ScanDocs\bla1.xml"),
                insert node <f2>function2 </f2> as last into $c                 
              
            )} catch * {                
                insert node <f2>{"Error: "|| $err:code || ': ' || 
$err:description}</f2> as last into $c                
            }
};


—————————————
Result: 

<?xml version="1.0" encoding="ISO-8859-1"?>
<Postabschluss>
 <>
<Datei uuid="8ad03f50-4b9c-461a-b818-1a97dc5735e9">
 <>
<sortedPath znen=""> 
<>@SMB10.211.55.6/netzlaufwerktestF/sortierter_Posteingang/OHNE/#Fax_OHNE_AZ--201803061002-154925-00498171251x1800.pdf</sortedPath>
<f1> <>function1 </f1>
<f2> <>function2 </f2>
</Datei>
<Datei uuid="26a3aee7-a0d8-4b8d-acd4-90554c8ab28c">
 <>
<sortedPath znen=""> 
<>@SMB10.211.55.6/netzlaufwerktestF/sortierter_Posteingang/OHNE/#Fax_OHNE_AZ--201803061003-154928-0049242344x1801.pdf</sortedPath>
<f1> <>function1 </f1>
<f2> <>function2 </f2>
</Datei>
<Datei uuid="af0548aa-08cf-464a-839d-421363f452ce">
 <>
<sortedPath znen=""> 
<>@SMB10.211.55.6/netzlaufwerktestF/sortierter_Posteingang/OHNE/#Fax_OHNE_AZ--201803061220-154966-004999429025.pdf</sortedPath>
<f1> <>function1 </f1>
<f2> <>function2 </f2>
</Datei>
——————



But if remove the line: prof:void("“),
the result is:

<?xml version="1.0" encoding="ISO-8859-1"?>
<Postabschluss>
 <>
<Datei uuid="8ad03f50-4b9c-461a-b818-1a97dc5735e9">
 <>
<sortedPath znen=""> 
<>@SMB10.211.55.6/netzlaufwerktestF/sortierter_Posteingang/OHNE/#Fax_OHNE_AZ--201803061002-154925-00498171251x1800.pdf</sortedPath>
</Datei>
<Datei uuid="26a3aee7-a0d8-4b8d-acd4-90554c8ab28c">
 <>
<sortedPath znen=""> 
<>@SMB10.211.55.6/netzlaufwerktestF/sortierter_Posteingang/OHNE/#Fax_OHNE_AZ--201803061003-154928-0049242344x1801.pdf</sortedPath>
</Datei>
<Datei uuid="af0548aa-08cf-464a-839d-421363f452ce">
 <>
<sortedPath znen=""> 
<>@SMB10.211.55.6/netzlaufwerktestF/sortierter_Posteingang/OHNE/#Fax_OHNE_AZ--201803061220-154966-004999429025.pdf</sortedPath>
</Datei>
</Postabschluss>


Do you have any explanation for this behavour?
Some other updating expression instead of prof:void(„“) works as well. But if 
my only call is to the functions, it does not work.

Sincerely
Dieter Zanzinger

Reply via email to