- From: Norman Walsh <ndw@nwalsh.com>
- Date: Fri, 05 Oct 2007 13:59:16 -0400
- To: public-xml-processing-model-comments@w3.org
- Message-ID: <m2d4vtfnnv.fsf@nwalsh.com>
Here's a proposal for p:exec: (Let's argue about whether "exec" is an
abbreviatio or not some other time :-)
<p:declare-step type="p:exec">
<p:input port="source" primary="true" sequence="true"/>
<p:output port="result" primary="true"/>
<p:output port="errors"/>
<p:option name="command" required="true"/>
<p:option name="args"/>
<p:option name="cwd"/>
<p:option name="source-is-xml" value="true"/>
<p:option name="result-is-xml" value="true"/>
<p:option name="errors-is-xml" value="false"/>
<p:option name="fix-slashes" value="false"/>
<!-- plus the serialization options -->
<p:option name="byte-order-mark"/>
<p:option name="cdata-section-elements"/>
<p:option name="doctype-public"/>
<p:option name="doctype-system"/>
<p:option name="encoding"/>
<p:option name="escape-uri-attributes"/>
<p:option name="include-content-type"/>
<p:option name="indent" value="false"/>
<p:option name="media-type"/>
<p:option name="method" value="xml"/>
<p:option name="normalization-form"/>
<p:option name="omit-xml-declaration"/>
<p:option name="standalone"/>
<p:option name="undeclare-prefixes"/>
<p:option name="version" value="1.0"/>
</p:declare-step>
Executes $command with $args, feeding "source" to stdin and reading
"result" from stdout and "errors" from stderr.
Any "/" or "\" in the $command are transformed into the
platform-specific path separator character.
If $cwd is specified, then the current working directory is changed to
$cwd before execution begins. It is a dynamic error if that's not
possible. If $cwd is not specified, the current working directory is
implementation-defined.
$args is interpreted as a sequence of whitespace-separated values.
Single or double quotes may be used to group arguments containing
whitespace. A \" or \' is taken as a literal quote character. A
backslash is \\.
For example:
<p:option name="args" value='a b c "c d e" \"f g\" 'g h''/>
Sets the arguments to (using square brackets as a visal delimeter):
[a] [b] [c] [c d e] ["f] [g"] [g h]
if $fix-slashes is true, all "/" or "\" in $args are transformed into
the platform-specific path separator character.
If $source-is-xml is true, then the serialization options are used to
convert each of the inputs into serialized XML and they're written to
the commands stdin.
If $source-is-xml is false, the XPath 1.0 string-value of the document
node of each of the inputs is written to stdin.
If $result-is-xml/errors-is-xml is true, then the result is parsed with
namespaces turned on, validation turned off, and no further
processling (like p:document).
If $result-is-xml/errors-is-xml is false, then the result is a c:result
element containing the escaped output.
I think that covers it. Argument processing sort of sucks. I wonder
if we need to worry about setting environment variables.
I think if we need something more complicated, we'll end up going the
route of http-request :-)
Be seeing you,
norm
--
Norman Walsh <ndw@nwalsh.com> | Everything should be made as simple as
http://nwalsh.com/ | possible, but no simpler.
Received on Friday, 5 October 2007 17:59:30 UTC