1.1 --- a/libxml2dom/macrolib/macrolib.py Mon Jan 24 12:46:24 2005 +0000
1.2 +++ b/libxml2dom/macrolib/macrolib.py Mon Jan 24 12:46:44 2005 +0000
1.3 @@ -56,7 +56,7 @@
1.4 }
1.5
1.6 def Node_ownerDocument(node):
1.7 - return libxml2mod.doc(node)
1.8 + return libxml2mod.doc(node) or node
1.9
1.10 def Node_nodeType(node):
1.11 global _nodesTypes
1.12 @@ -266,12 +266,11 @@
1.13
1.14 def Node_xpath(node, expr, variables=None, namespaces=None):
1.15 context = libxml2mod.xmlXPathNewContext(Node_ownerDocument(node))
1.16 - libxml2mod.xmlXPathSetContextNode(context, node)
1.17 # NOTE: Discover namespaces from the node.
1.18 for prefix, ns in (namespaces or {}).items():
1.19 libxml2mod.xmlXPathRegisterNs(context, prefix, ns)
1.20 # NOTE: May need to tidy up the context.
1.21 - return libxml2mod.xmlXPathEval(context, expr)
1.22 + return libxml2mod.xmlXPathEval(expr, context)
1.23
1.24 # Utility functions.
1.25