Matthew J. Graham wrote:
If the while clause is written out as a separate xpl file and xpl supports recursive calls to itself then there is a workaround (similar to recursive template calling with stylesheets) as the operation is additive.
Yes, XPL supports recursion. See for instance the attached XPL, part of the test suite.
Alex
<!--
Copyright (C) 2004 Orbeon, Inc.
This program is free software; you can redistribute it and/or modify it under the terms of the
GNU Lesser General Public License as published by the Free Software Foundation; either version
2.1 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU Lesser General Public License for more details.
The full text of the license is available at http://www.gnu.org/copyleft/lesser.html
-->
<p:config xmlns:p="http://www.orbeon.com/oxf/pipeline"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<p:param type="input" name="data"/>
<p:param type="output" name="data"/>
<p:choose href="#data">
<p:when test="/count = 0">
<p:processor uri="oxf/processor/identity">
<p:input name="data" href="#data"/>
<p:output name="data" ref="data"/>
</p:processor>
</p:when>
<p:otherwise>
<p:processor uri="oxf/processor/xslt">
<p:input name="data" href="#data"/>
<p:output name="data" id="new-value"/>
<p:input name="config">
<xsl:stylesheet version="1.0">
<xsl:template match="/">
<count><xsl:value-of select="/count - 1"/></count>
</xsl:template>
</xsl:stylesheet>
</p:input>
</p:processor>
<p:processor uri="oxf/processor/pipeline">
<p:input name="config" href="oxf:/unit-tests/recurse.xml"/>
<p:input name="data" href="#new-value"/>
<p:output name="data" ref="data"/>
</p:processor>
</p:otherwise>
</p:choose>
</p:config>
