Previous Up Next

cxf:copy

cxf:copy — Copies a file.

Synopsis

<p:declare-step type="cxf:copy">
     <p:output port="result" primary="false"/>
     <p:option name="href" required="true"/>                       <!-- anyURI -->
     <p:option name="target" required="true"/>                     <!-- boolean -->
     <p:option name="fail-on-error" select="'true'"/>              <!-- boolean -->
</p:declare-step>

Description

The cxf:copy copies the file named in href to the new name specified in target. If the target is a directory, the step attempts to move the file into that directory, preserving its base name.

If the copy is successful, the step returns a c:result element containing the absolute URI of the target.

If an error occurs, the step fails if fail-on-error is true; otherwise, the step returns a c:error element which may contain additional, implementation-defined information about the nature of the error.

Errors

Error Description
err:FU01 Occurs if the file named in href does not exist or cannot be copied to the specified target.

Examples

  1 <p:declare-step xmlns:p="http://www.w3.org/ns/xproc"
                    xmlns:cxf="http://xmlcalabash.com/ns/extensions/fileutils"
                    name="main" version="1.0">
    
  5   <p:output port="result">
        <p:pipe step="copy" port="result"/>
      </p:output>
    
      <p:import href="http://xmlcalabash.com/extension/steps/fileutils.xpl"/>
 10 
      <cxf:copy name="copy" href="copy-1.xpl" target="/tmp/copied.xpl"/>
    
    </p:declare-step>
<c:result xmlns:c="http://www.w3.org/ns/xproc-step">file:/tmp/copied.xpl</c:result>