Re: An unfulfilled requirement maybe?

/ Vasil Rangelov <boen.robot@gmail.com> was heard to say:
|>An XML document goes in the input port and it's connected to stdin on the
| program that runs.
|>
|>I'm tempted to special case an empty binding to stdin.
|
| I'm confused. Don't you need the program to be already started in order to
| use the input stream? That's how most shells (actually... all that I've
| used) usually do it at least. And if that's the case here too, what will the
| output and error streams look like when the input steam is used in the
| middle of the program?

Now I'm confused. The input that arrives on stdin is fed to the
program as it's stdin. The outputs that it produces on stdout and
stderr are (with appropriate escaping and wrapping) returned as the
stdout and stderr outputs from the step.

How the implementation arranges for this to happen is the
implementation's problem.

| How exactly is the input document used? Passed at once as a serialized
| document with the default serialization options?

I had in mind that it would be passed as a serialized text file. I
guess we'd need to provide serialization options to the step.

| If so, what about programs
| that don't accept XML document as their input?

Then stdin had best be bound to p:empty :-)

| Is the input's text contents
| supplied at once? Or is it each line of the text contents supplied for each
| time the application accepts input on the stdin stream? Possibly this could
| be adjustable with another option if so?

I don't think that matters. I'd expect the implementation library (or
the underlying OS) to deal with buffering issues. The pipeline
provides the document for stdin, how that's used by the application is
the application's problem.

Here's an example, btw:

<p:pipeline name="main"
            xmlns:p="http://www.w3.org/ns/xproc"
	    xmlns:px="http://xproc.org/ns/xproc/ex"
            xmlns:c="http://www.w3.org/ns/xproc-step"
            xmlns:err="http://www.w3.org/ns/xproc-error">
<p:input port="source">
  <p:inline>
    <doc>
      <p>para</p>
    </doc>
  </p:inline>
</p:input>
<p:output port="result"/>
  
<px:exec name="exec" command="head" args="/Users/ndw/.bashrc">
  <p:input port="stdin">
    <p:pipe step="main" port="source"/>
  </p:input>
</px:exec>

</p:pipeline>

$ xproc test.xpl
<?xml version="1.0" encoding="UTF-8"?>
<c:result xmlns:c="http://www.w3.org/ns/xproc-step"># ~/.bashrc: executed by bash(1) for non-login shells.

set -a
bind 'set mark-symlinked-directories on'

umask 022

PS1="\h:\w\$ "

# Who sets this!?
</c:result>

                                        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 Sunday, 30 September 2007 17:57:23 UTC