@microxpath_function('<STR_LIT>')<EOL>def foreach_(ctx, seq, expr):
from . import context, parse as uxpathparse<EOL>if hasattr(seq, '<STR_LIT>'):<EOL><INDENT>seq = seq.compute(ctx)<EOL><DEDENT>expr = next(string_arg(ctx, expr), '<STR_LIT>')<EOL>pexpr = uxpathparse(expr)<EOL>for item in seq:<EOL><INDENT>innerctx = ctx.copy(item=item)<EOL>yield from pexpr.compute(innerctx)<EOL><DEDENT>
Yields the result of applying an expression to each item in the input sequence.

* seq: input sequence
* expr: expression to be converted to string, then dynamically evaluated for each item on the sequence to produce the result