(Q22) Find the maximum depth of the document named "partlist.xml."
NAMESPACE xsd="http://www.w3.org/2001/03/XMLSchema-datatypes"
FUNCTION depth(ELEMENT $e) RETURNS xsd:integer
{
-- An empty element has depth 1
-- Otherwise, add 1 to max depth of children
IF empty($e/*) THEN 1
ELSE max(depth($e/*)) + 1
}
depth(document("partlist.xml"))