FW: p:store and default readable ports

Alex,

Did you mean to reply-all?

From: Alex Muir [mailto:alex.g.muir@gmail.com]
Sent: 25 November, 2010 11:28 AM
To: Philip Fennell
Subject: Re: p:store and default readable ports

I asked this question a while back and based on response from James Sulak

http://markmail.org/search/?q=list%3Axproc-dev+p%3Astore#query:list%3Axproc-dev%20p%3Astore%20from%3A%22Alex%20Muir%22+page:2+mid:ictw4wbiqi5k2bte+state:results

I use the following:

The code uses a declared step which handles the identity and then accepts a boolean to determine if the output should be written using the passed href parameter as the file name.

 <p:declare-step name="saveDocument" type="mh:save-output">
    <p:input port="source" primary="true"/>
    <p:output port="result">
      <p:pipe port="result" step="ident"/>
    </p:output>
    <p:option name="step-name" required="true"/>
    <p:option name="save" select="'false'"/>
    <p:option name="href" required="true"/>
    <p:identity name="ident"/>

    <p:choose>
      <p:when test="$save = 'true'">
        <p:store>
          <p:with-option name="href" select="$href">
            <p:pipe port="result" step="ident"/>
          </p:with-option>
        </p:store>
      </p:when>
      <p:otherwise>
        <p:sink/>
      </p:otherwise>
    </p:choose>
  </p:declare-step>

And use it in the code.

         <mh:save-output step-name="debug1">
            <p:with-option name="save" select="~~~debug~~~"/>
            <p:with-option name="href"
              select="concat($debug-output-folder,'debug-1.xml')"/>
          </mh:save-output>

replace the ~~~debug~~~ with true() or false()

Alex

Some good music
http://www.facebook.com/pages/Bafila-Acoustic-Trio/125611807494851
On Wed, Nov 24, 2010 at 4:41 PM, Philip Fennell <Philip.Fennell@marklogic.com<mailto:Philip.Fennell@marklogic.com>> wrote:
Tony,

As I myself found out recently, the p:store step doesn't have a primary output port so that you don't have to explicitly bind the following step to it. Your subsequent step can use a p:pipe on its input source to bind it to the result of the step before the p:store.

...
<p:http-request name="request"/>
<p:store href="foo.xml"/>
<p:xslt>
  <p:input port="source">
    <p:pipe port="result" step="request"/>
  </p:input>
  ...
</p:xslt>
...

Something like that.

Regards

Philip

From: xproc-dev-request@w3.org<mailto:xproc-dev-request@w3.org> [mailto:xproc-dev-request@w3.org<mailto:xproc-dev-request@w3.org>] On Behalf Of Tony Rogers
Sent: 24 November, 2010 4:17 PM
To: XProc Dev
Subject: p:store and default readable ports

I know that the p:store step does not have a primary output.

My general question:
            Does this mean that in a pipeline that flows in the default order (top to bottom of pipeline document), p:store cannot be used in the middle of things?

My pipeline specifics:
            I have a pipeline that does an HTTP request.  I want to store the results of that request, AND I also want to perform some further processing on those results immediately after storing them.
            The problem is that if I store them, p:store does not have a primary output, so the automatic flow of my pipeline stops.  :(


-Tony

Received on Thursday, 25 November 2010 12:13:00 UTC