An example of a simple case of foreach usage is given below.
namespace po = "http://example.com/po";
foreach item of po *~ "po:purchaseOrder/po:itemsList/po:item[@a > 10]" {
f(item1.a);
}
General case
An example of a general case of foreach usage is given below.
namespace po = "http://example.com/po";
val po = …;
val xml = …;
foreach item1 of po *~ "po:purchaseOrder/po:itemsList/po:item[@a > 10]",
item2 of xml *~ "po:a/po:b[@x = ‘aa’]/po:e[@a > 10]"
where item1.a > item2.b
{ f(item1.a, item2.b);
}