         return XPathResult(ptr: obj, onNode: node)
     }
 
+    /// Evaluates the XPath query with the given document's root node as context node.
     public func evaluateOn(doc: Document) throws -> XPathResult {
         return try evaluateOn(doc.root)
     }

        return xmlXPathCastToBoolean(ptr) != 0
    }

    public func asNumber() -> Double {
        return xmlXPathCastToNumber(ptr)
    }

    }

    public func asNodeSet() -> [Node]? {
        // TODO: Maybe we want an empty list in the "default" case? This would be in line with the other asType() functions.
        switch value {
        case .NodeSet(let nodes): return nodes
        default: return nil
