Optimizing Sorting and Duplicate Elimination in XQuery Path