PositionScope pc = expressionContext.getPositionScope();
// Declare an unitialized variable.
InternalExpressionScope scope = (InternalExpressionScope)
expressionContext.getCurrentScope();
Variable variable = scope.declareVariable(variableName);
// Iterate over the sequence.
int length = sequence.getLength();
for (int i = 1; i <= length; i += 1) {
// Increment to the next position in the sequence
pc.increment();
// Get the item.
try {
variable.setValue(sequence.getItem(i));
} catch (SequenceIndexOutOfBoundsException e) {
throw new ExtendedSAXException(e);
}
// Replay the events through the dynamic process.