RE: How to invoke a step recursively?

Hi,

You will need to give the step a type, for instance like this:

<p:declare-step name="myPipeline" type="my:pipeline"
 	xmlns:c="http://www.w3.org/ns/xproc-step"
 	xmlns:p="http://www.w3.org/ns/xproc"
      xmlns:my="http://www.example.com/ns/xproc">
  ...


You can then call your pipeline recursively like any other XProc step:

<my:pipeline>
  ...
</my:pipeline>

Also, if you want your pipeline to take the output of the previous
iteration as its input, you probably will have to add an input port to
the pipeline.

Regards,
Vojtech


> -----Original Message-----
> From: xproc-dev-request@w3.org 
> [mailto:xproc-dev-request@w3.org] On Behalf Of Manfred Staudinger
> Sent: Friday, September 11, 2009 1:09 PM
> To: xproc-dev
> Subject: How to invoke a step recursively?
> 
> I would like to invoke step level-1 of my pipeline [1] recursively. So
> iteration n should invoke this step with using the output from
> iteration n-1 as its input. I need to have also the output from all
> the iterations explicit in result. How can I achive this?
> 
> Regards,
> Manfred
> 
> [1] xpl:
> <p:declare-step name="myPipeline"
> 	xmlns:c="http://www.w3.org/ns/xproc-step"
> 	xmlns:p="http://www.w3.org/ns/xproc">
> 	<p:option name="dir"/>
> 	<p:output port="result" sequence="true">
> 		<p:pipe step="level-0" port="result"/>
> 		<p:pipe step="level-1" port="result"/>
> 	</p:output>
> 	<p:serialization port="result" indent="true" 
> omit-xml-declaration="false"/>
> 	<p:directory-list name="level-0">
> 		<p:with-option name="path" select="concat($dir,
> '/')"><p:empty/></p:with-option>
> 	</p:directory-list>
> 	<p:make-absolute-uris match="*/c:directory/@name">
> 		<p:with-option name="base-uri" 
> select="concat($dir, '/')"/>
> 	</p:make-absolute-uris>
> 	<p:for-each name="level-1">
> 		<p:iteration-source select="/c:directory/c:directory"/>
> 		<p:output port="result"/>
> 		<p:variable name="dirpath" 
> select="concat(c:directory/@name, '/')"/>
> 		<p:directory-list>
> 			<p:with-option name="path" select="$dirpath"/>
> 		</p:directory-list>
> 		<p:make-absolute-uris match="*/c:directory/@name">
> 			<p:with-option name="base-uri" 
> select="$dirpath"/>
> 		</p:make-absolute-uris>
> 	</p:for-each>
> </p:declare-step>
> 
> 
> 

Received on Friday, 11 September 2009 11:36:26 UTC