The p:file-copy
step copies a file.
<p:declare-step
type
="
p:file-copy
"
>
<p:output
port
="
result
"
primary
="
true
"
content-types
="
application/xml
"
/>
<p:option
name
="
href
"
required
="
true
"
as
="
xs:anyURI
"
/>
<p:option
name
="
target
"
required
="
true
"
as
="
xs:anyURI
"
/>
<p:option
name
="
fail-on-error
"
as
="
xs:boolean
"
select
="
true()
"
/>
</p:declare-step>
The p:file-copy
step copies the file or directory 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.
Conformant processors must support URIs whose
scheme is file
for the href
and target
options
of p:file-copy
.
It is implementation-defined what other schemes are
supported by p:file-copy
, and what the interpretation
of ‘directory’, ‘file’ and ‘contents’ is for those schemes.
It is a dynamic error (err:XC0144
) if an
implementation does not support p:file-copy
for a specified scheme.
If href
or target
are relative, they are made absolute against the
base URI of the element on which they are specified
(p:with-option
or p:file-copy
in the case of a
syntactic shortcut value). It is a dynamic
error (err:XD0064
) if the base URI is not both absolute and valid according to [RFC 3986]. It is a
dynamic error (err:XC0145
) if p:file-copy
is not available to the step due to access restrictions
in the environment in which the pipeline is run.
If the copy is successful, the step returns a c:result
element containing the absolute URI of the
target.
If an error occurs and fail-on-error
is false
, the step returns a
c:error
element which may contain additional, implementation-defined, information about the nature of
the error.
If an error occurs and fail-on-error
is true
, one of the following errors is
raised:
-
It is a dynamic error (
err:XD0011
) if the resource referenced by thehref
option does not exist, cannot be accessed or is not a file or directory. -
It is a dynamic error (
err:XC0050
) the file or directory cannot be copied to the specified location.
Document properties
The resulting document has no properties
apart from content-type
. In particular, it has no base-uri
.