Using a rich framework for expressing sophisticated aggregate queries on XML data with grouping, nesting, having, and moving window aggregations, we developed an efficient disk-based algorithm for computing all such queries. Using a comprehensive set of experiments, we showed that our algorithm has stability, scalability, and efficiency, and is often orders of magnitude faster than existing approaches, when they are applicable. Furthermore, our algorithm naturally supports several optimizations which improve its efficiency even further.