# File lib/libxml/node.rb, line 49 def context(nslist = nil) if not self.doc raise(TypeError, "A node must belong to a document before a xpath context can be created") end context = XPath::Context.new(self) context.node = self context.register_namespaces_from_node(self) context.register_namespaces_from_node(self.doc.root) context.register_namespaces(nslist) if nslist context end