RE: Is there a way to implement feedback loops in XProc?

Hi Roger,

You can't tie the output of a step to the input of the same step, but you
can add a step as a child of itself. Just make sure you wrap it in some
conditional to terminate recursion.

Perhaps not the most lucid example, but you could take a look at
expand-dirs in
https://github.com/grtjn/xproc-ebook-conv/blob/master/src/nl/grtjn/xproc/u
til/utils.xpl. It does a recursive reading of a directory..

Kind regards,
Geert

> -----Oorspronkelijk bericht-----
> Van: Costello, Roger L. [mailto:costello@mitre.org]
> Verzonden: woensdag 1 mei 2013 21:36
> Aan: xproc-dev@w3.org
> Onderwerp: Is there a way to implement feedback loops in XProc?
>
> Hi Folks,
>
> The spec says [1] that no feedback loops are allowed in an XProc
pipeline:
>
>     It is a static error (err:XS0001) if there
>     are any loops in the connections between
>     steps: no step can be connected to itself
>     nor can there be any sequence of connections
>     through other steps that leads back to itself.
>
> So how are recursive structures processed?
>
> As a simple example, suppose "Section" is defined recursively:
>
> Section = Title | Title Section
>
> If XProc supported feedback loops I would create a step in the pipeline
that
> processes the content of a Section and the output is the nested Section,
> which is is fed back around to the step:
>
> ---> Step (process Section content) ----------
> ^                                                       		|
> |					|
> -------<--------<------------------<-----------<----
>                   (nested Section)
>
> Since feedback loops are not allowed, how is this type of thing
> accomplished in XProc? Note: I need to implement this using XProc and
not
> simply hand it off to XSLT to implement the recursive processing.
>
> /Roger
>
> [1] http://www.w3.org/XML/XProc/docs/langspec.html#connections

Received on Wednesday, 1 May 2013 20:20:32 UTC