An unfulfilled requirement maybe?

The requirements of XProc mention
"
Run a program of your own, with some parameters, on an XML file and display
the result in a browser.
"
And this seems to be something XProc doesn't really allow. You can create
your own pipelines, OK. XProc provides means for third party extension
steps. OK. But there's no step or anything to allow you to run a program of
your own with some parameters.

I suggest a new step for this that would execute a command on the command
line. The exact command line interpreter and it's properties (such as an
initial directory to which paths would be relative to, etc.) would probably
have to be left implementation dependant. The signature I'm suggesting is
this:

<p:declare-step name="p:command-line">
	<p:output port="result"/><!-- Returns a c:result element with the
output of the program (from the standard output stream) into a c:output
element. Any errors the program may have are taken from the standard error
stream and into a c:errors element. Each line of the output/error stream is
placed in a c:line element.-->
	<p:option name="line"/><!-- The complete command line to be passed,
including its parameters.-->
	<p:option name="wrap-output"/><!-- If set to true/yes, all lines of
the output stream will be outputted as is in the c:output element. -->
	<p:option name="wrap-errors"/><!-- If set to true/yes, all lines of
the error stream will be outputted as is in the c:errors element. -->
</p:declare-step>

Example use case - use another XSLT/FO/Schema/RNG/whatever processor, not
supported by the XProc processor:

The following pipeline
<p:pipeline name="pipeline" xmlns:p="http://www.w3.org/2007/03/xproc">
	<p:option name="source" value="file.xml"/>
	<p:option name="stylesheet" value="file.xsl"/>
	<p:output port="result" primary="yes"/>

	<p:command-line>
		<p:option name="line" select="concat('myProcessor.exe
',$source,' ',$stylesheet)"/>
	</p:command-line>
</p:pipeline>

May result to
<c:result>
	<c:output>
		<c:line>This first line of the program.</c:line>
		<c:line>Yes, a dummy program, I know</c:line>
	</c:output>
</c:result>
On success or
<c:result>
	<c:error>
		<c:line>This first line of the error.</c:line>
		<c:line>Yes, a dummy error, I know</c:line>
	</c:error>
</c:result>
Or
<c:result>
	<c:error>
		<c:line>This first line of the error.</c:line>
		<c:line>Yes, a dummy error, I know</c:line>
	</c:error>
	<c:output>
		<c:line>This first line of the program.</c:line>
		<c:line>Yes, a dummy program, I know</c:line>
	</c:output>
</c:result>
If the program has output, but also has errors.

Regards,
Vasil Rangelov

Received on Monday, 17 September 2007 17:47:12 UTC