Code: Select all
for $node in ( //*:section )
let $new_att_node := mwclib:augment($node)
insert node $new_att_node into $node
The problem is that the function mwclib:augment() depends on evaluating the entire document so after the first iteration the section element is modified to have the new attribute and on the second iteration the function needs to know about the data inserted in iteration one, but that doesn't seem to be happening. Is there a way to signal a document update between iterations?