To learn more about XQuery FLWR expressions (for, let, where, and return), see the following URL:
http://www.w3.org/TR/2002/WD-xquery-20020816/#id-flwr-expressions
To learn more about using the for and where clauses, see Step 4: Mapping a Repeating Element (Join) in Tutorial: Building Your First Data Transformation.