What a scripting language XSH would be had it not some kind of conditional statements, loops and other stuff that influences the way in which XSH commands are processed.
Most notable XSH's feature in this area is that some of the basic flow control statements, namely if, unless, while and foreach have two variants, an XPath-based one and a Perl-based one. The XPath-based variant uses xpath expressions to specify the condition or node-lists to iterate, while the other one utilizes perl-code for this purpose. See descriptions of the individual statements for more detail.
call user-defined routine (macro)
single XSH command or a block of XSH commands
sub-routine (macro) declaration
exit XSH shell
loop iterating over a node-list or perl array
if statement
conditionally include another XSH source in current position
include another XSH source in current position
iterate a block over current subtree
immediately exit an enclosing loop
start the next iteration of an enclosing loop
restart an iteration on a previous node
restart the innermost enclosing loop block
return from a subroutine
switch into normal execution mode (quit test-mode)
process selected elements from an XML stream (EXPERIMENTAL)
do not execute any command, only check the syntax
throw an exception
try/catch statement
undefine sub-routine (macro)
negated if statement
simple while loop