We describe and evaluate a query minimization technique that applies to XQueries, which are nested, perform arbitrary joins, and freely mix bag and set semantics. These features create key challenges that fundamentally extend the problem of minimizing conjunctive queries (no nesting, no mixed semantics) or tree pattern XPath expressions (no nesting, no joins, no bag semantics). The technique detects and removes redundant navigation across and within nested subqueries. An important application of this technique is group-by detection.