Re: Storing a document mid sequence. Can it be done?

To expand on what Vojtech said, here's a step I use a lot for that.
It takes a $debug option, which when true stores it to disk.  In
either case it appears to the rest of the pipeline as an identity
step.  I can put a bunch of these in a pipeline, and by setting a
pipeline-level option, get a bunch of intermediate XML stored to disk
while debugging and later turn it off:

Call it like this:

<wxp:debug-output step-name="0-article-titles">
        <p:with-option name="debug" select="$debug"/>
</wxp:debug-output>


  <!-- This step sends it's primary input to a file specified by "step-name."
       It is used for seeing the output of an intermediary step.  -->

  <p:declare-step name="debug" type="wxp:debug-output">
    <p:input port="source" primary="true"/>
    <p:output port="result">
      <p:pipe step="ident" port="result"/>
    </p:output>
    <p:option name="debug" select="'false'"/>
    <p:option name="step-name" required="true"/>

    <p:identity name="ident"/>

    <p:choose>
      <p:when test="$debug = 'true'">
        <p:store>
          <p:with-option name="href" select="concat($step-name, '.debug')"/>
          <p:input port="source">
            <p:pipe port="result" step="ident"/>
          </p:input>
        </p:store>
      </p:when>
      <p:otherwise>
        <p:sink/>
      </p:otherwise>
    </p:choose>
  </p:declare-step>

On Thu, Mar 4, 2010 at 7:48 AM, Alex Muir <alex.g.muir@gmail.com> wrote:
> Hi,
>
> I was reading a post here
>
> http://markmail.org/search/?q=list%3Axproc-dev+p%3Astore#query:list%3Axproc-dev%20p%3Astore+page:1+mid:xzoj5hpzbz5jt2k2+state:results
>
> That stated:
>
> "If you stick a p:store in the middle of a sequence, odds are good you
> aren't going to get the result you expected. So by making the output port
> not-primary, the pipeline author is forced to be explicit about the bindings
> desired."
>
> Is there a way to save a copy of what the current document looks like mid
> sequence and continue processing?
>
> Regards
> --
> Alex
> https://sites.google.com/a/utg.edu.gm/alex
>
> Some Good Music
> http://sites.google.com/site/greigconteh/
>

Received on Thursday, 4 March 2010 13:59:07 UTC