cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sebastian Klamar <>
Subject repeat-until for Sitemap Logic -- better solution?
Date Sat, 29 Nov 2003 08:35:28 GMT
Is there any sitemap logic like a repeat-until statement Cocoon offers?
(Matchers work like if-then, Selectors like switch-case, with Actions you
can also simlutate a if-then afaik...)

I need to concatenate the same pipeline several times.  How often you
concatenate is not static (so I cannot place pipeline sequence several
times into sitemap.xmap).  Afterwards you have examined the output at
the end of the pipeline you decide whether you have ti go back to the
beginning of the pipeline where you inject the SAX stream the same
pipeline generated before.  So in programming language you would use
something like

  input = previousPipeline();
  repeat {  
    output = transformA(input);
    input = output;
    output = transformB(input);
    input = output;
  } until (out.isOkay());

My current solution uses Flowscript.  The pipeline inside
the repeat-until block gets called several times via Flow's
processPipelineTo().  Flow only gets a byte stream as output which I
cant inject into the next call of the pipeline.  Therefore I write
the SAX stream at the last stage of the pipeline to a transient store
(working like FragmentExtractorTransformer) and write the id into a
session variable.  The id is used to call the pipeline the next time
which can refer to the id to get the SAX stream from the last iteration?
Also at the very last stage of the pipeline the decision whether a next
iteration is need gets written as a session variable.

Do you know any better solution?  I don't like the use of the two session
variables to simulate concatenation and the decision making at the end
of the loop.

TIA -- Sebastian

Die letzten Worte...
      des Politikers: "...und wenn ich gewählt werde, verspreche ich..."
PGP Key: 0x1E727CE6 / 9085 48BD 8332 4BFC D80C  A6CF D162 20BB 1E72 7CE6

View raw message