Re: Looping input and output in XProc

In a future revision of XProc it would be nice to have a way to do this
without recursion though. A way of piping the result of one iteration into
the next iteration in a loop could be very useful indeed. Another use-case
for this that I can think of for this is when you want to retrieve a list
of something from a web service where the results are paginated
(potentially thousands of pages), and you need a resumption token provided
in the previous request to retrieve the next page. This is the case for the
OAI-PMH protocol[1], and I'm sure many others. The recursion depth can grow
quite deep.

[1] http://www.oaforum.org/tutorial/english/page4.htm#section9

Jostein


On Fri, Sep 21, 2012 at 11:40 AM, Nic Gibson <nicg@corbas.co.uk> wrote:

> Hah. I *knew* there was something I should have thought of. Thank you!
>
> nic
> --
> Corbas Consulting / @CorbasLtd
> Digital Publishing Consultancy and Training
> http://www.corbas.co.uk, +44 (0)7718 906817/+44 (0)1273 930765
>
> On 21 Sep 2012, at 08:58, Jostein Austvik Jacobsen <josteinaj@gmail.com>
> wrote:
>
> Depending on how many XSLTs you want to apply, recursion would be an
> alternative...
>
> Jostein
>
>
> On Thu, Sep 20, 2012 at 5:19 PM, Nic Gibson <nicg@corbas.co.uk> wrote:
>
>> Hi Folks
>>
>> I have a problem that is best expressed as something like this (given an
>> xml document xmldoc initialised to the initial input)
>>
>> 1. fetch URL for XSLT from list
>> 2. Load XSLT file
>> 2. process xmldoc with XSLT
>> 3. set xmldoc to result
>> 4. fetch next file from from list. If found go to 1. If not emit current
>> xmldoc
>>
>> The problem is that I have an arbitrary collection of XSLT stylesheets
>> that I need to apply to an XML document passing the result of the first
>> transform to the second XSLT and so on. Right now, the only thing I can see
>> to do is to use another bit of XSLT to generate an XProc pipeline and
>> execute that. I would prefer to be able to do this without that and simply
>> express this as some sort of iteration in XProc.
>>
>> I haven't been able to think of a way that I can express this in XProc.
>> Anyone get some spare intuition?
>>
>>
>> thanks
>> nic
>> --
>> Corbas Consulting / @CorbasLtd
>> Digital Publishing Consultancy and Training
>> http://www.corbas.co.uk, +44 (0)7718 906817/+44 (0)1273 930765
>>
>>
>
>

Received on Friday, 21 September 2012 10:32:59 UTC