- From: Norm Tovey-Walsh <norm@saxonica.com>
- Date: Fri, 10 Oct 2025 10:16:08 +0100
- To: "public-xslt-40@w3.org" <public-xslt-40@w3.org>
Hello,
A while back, I took an action to compare the EXPath file module with the XProc file steps. Here’s a summary:
* File properties
+ file:name
No equivalent; examine the URI.
+ file:last-modified
+ file:size
+ file:is-dir
+ file:is-file
+ file:exists
In XProc, there’s a p:file-info step that can provide these details. It returns a c:file (or c:directory) element:
<c:file
name = string
size? = integer
readable? = boolean
writable? = boolean
last-modified? = dateTime
hidden? = boolean
content-type? = ContentType />
+ file:is-absolute
No equivalent; examine the URI.
* File manipulation
+ file:copy
Similar to the p:file-copy step; XProc provides an option to control whether existing files should be overwritten (alternatively, it’s an error to attempt the copy).
+ file:create-dir
Similar to the p:file-mkdir step.
+ file:create-temp-dir
No equivalent.
+ file:create-temp-file
Similar to the p:file-create-tempfile. XProc doesn’t allow the user to specify the directory; it relies on OS features for creating a temp file.
+ file:delete
Similar to the p:file-delete step.
+ file:move
Similar to p:file-move, but XProc doesn’t allow a move operation to overwrite a file.
* Input/Output
+ file:append
+ file:append-binary
+ file:append-text
+ file:append-text-lines
No equivalent.
+ file:read-binary
XProc can read binary documents, but it can’t select offsets and lengths during the read operation.
+ file:read-text
XProc can read text documents, but doesn’t have the $fallback functionality.
+ file:read-text-lines
No direct equivalent, but you can read text and the split it on newlines.
+ file:write
+ file:write-binary
+ file:write-text
Similar to p:store. XProc doesn’t separate the binary and non-binary cases, the p:store step handles both.
+ file:write-text-lines
No direct equivalent, but you can concatent the lines and write the text.
* Paths
+ file:parent
No equivalent.
+ file:children
+ file:descendants
+ file:list
Similar to the p:directory-list step with options appropriate to each case.
+ file:list-roots
No equivalent.
+ file:resolve-path
+ file:path-to-uri
XProc has a p:urify() function that is broadly equivalent, I believe.
+ file:path-to-native
No equivalent.
* System Properties
+ file:dir-separator
+ file:path-separator
+ file:current-dir
Reported, along with other details, by the p:os-info step.
+ file:temp-dir
No equivalent; though arguably that should also be returned by p:os-info.
+ file:line-separator
No equivalent; but not hard to work out from the os-name property returned by p:os-info.
+ file:base-dir
No equivalent, but achievable by string manipulation.
Be seeing you,
norm
--
Norm Tovey-Walsh
Saxonica
Received on Friday, 10 October 2025 09:16:18 UTC