How it works

The Iteration operation 'while_not' evaluates the contents of the body repeatedly until a condition is met within the control. If the control is a store, the iteration repeats until the store exists.

The 'while_not' operation will evaluate the body whilst the input specified does not exist. The control is evaluated before each iteration, therefore there may be cases where the body is never evaluated. This will result in no ouput being generated.

'While_Not' Example

The following example goes through a list of urls and calls each one until an error occurs.

<instruction note="load list of urls">
	<output space="store" value="urllist" />
	<input space="file" value="urllist.xml" />
</instruction>
<iteration operation="while_not" note="iterate until an error occurs">
	<control space="store" value="error" />
	<body>
		<instruction>
			<output space="store" value="result" />
			<output space="error" value="error" />
			<input space="url" context="store" >
				<s value="urllist!#/list/url[" />
				<s space="field" value="#row" />
				<s value="]/@url" />
			</input>
		</instruction>
	</body>
</iteration>

Example urllist.xml for the code above:

<list>
	<page url="http://www.obyx.org" />
	<page url="http://news.bbc.co.uk/" />
	<page url="http://www.google.co.uk/" />
</list>



Last Modified: Thu, 15 Jan 2015