W3C home > Mailing lists > Public > xproc-dev@w3.org > February 2013

Problems when copying files

From: George Cristian Bina <george@oxygenxml.com>
Date: Fri, 15 Feb 2013 11:45:47 +0200
Message-ID: <511E03CB.5080700@oxygenxml.com>
To: xproc-dev@w3.org
Hi,

We obtain some strange results with the following script with Calabash 
1.0.8 (I think I encountered this also on previous versions).

We have the following structure:

./xml/test.xml
./test.xpl

See the files content below [1].

The test.xpl script should load the files from the xml folder and then 
store them in a folder called xml1, then load the files from the folder 
xml1 and store them in a folder xml2.

Trying to run the script gives the following error:
Scenario: test
XProc file: /Users/george/Documents/test/xproc_samples/test.xpl
Engine name: Calabash XProc
Severity: error
Description: err:XC0017 : XC0017 It is a dynamic error if the absolute 
path does not identify a directory.

I then created an xml1 folder so we have now the following structure

./xml/test.xml
./xml1/
./test.xpl

First run does not give any error but the result structure is

./xml/test.xml
./xml1/test.xml
./test.xpl

That is the file was copied to xml1 but no copy from xml1 to xml2 took 
place.
Running again the script with the new structure gives the desired result

./xml/test.xml
./xml1/test.xml
./xml2/test.xml
./test.xpl

Is this the expected behavior?

[1] sample files

test.xml
========
<test/>

test.xpl
========
<p:declare-step xmlns:p="http://www.w3.org/ns/xproc" 
name="sampleCopyTest" version="1.0"
   xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
xmlns:c="http://www.w3.org/ns/xproc-step">

   <p:input port="source" sequence="true"/>
   <p:output port="result" sequence="true">
     <p:empty/>
   </p:output>

   <p:variable name="input" select="'xml/'"/>
   <p:variable name="out1" select="'xml1/'"/>
   <p:variable name="out2" select="'xml2/'"/>

   <p:directory-list>
     <p:with-option name="path" select="$input"/>
   </p:directory-list>

   <p:for-each>
     <p:iteration-source select="/c:directory/c:file"/>
     <p:variable name="filename" select="/c:file/@name"/>
     <p:variable name="result" select="concat($out1, $filename)"/>

     <p:load>
       <p:with-option name="href" select="concat($input, $filename)"/>
     </p:load>
     <p:store omit-xml-declaration="false">
       <p:with-option name="href" select="$result"/>
     </p:store>

   </p:for-each>

   <p:directory-list>
     <p:with-option name="path" select="$out1"/>
   </p:directory-list>

   <p:for-each>
     <p:iteration-source select="/c:directory/c:file"/>
     <p:variable name="filename" select="/c:file/@name"/>
     <p:variable name="result" select="concat($out2, $filename)"/>
     <p:load>
       <p:with-option name="href" select="concat($out1, $filename)"/>
     </p:load>
     <p:store omit-xml-declaration="false">
       <p:with-option name="href" select="$result"/>
     </p:store>
   </p:for-each>

</p:declare-step>

-- 
Best Regards,
George
--
George Cristian Bina
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com
Received on Friday, 15 February 2013 09:46:14 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Friday, 15 February 2013 09:46:14 GMT