diff --git a/docs/usage.rst b/docs/usage.rst index f5950a88..5e32cf77 100644 --- a/docs/usage.rst +++ b/docs/usage.rst @@ -1130,7 +1130,7 @@ Converting CSS to XPath When you're using an API that only accepts XPath expressions, it's sometimes useful to convert CSS to XPath. This allows you to take advantage of the -conciseness of CSS to query elements by classes and the easeness of +conciseness of CSS to query elements by classes and the easiness of manipulating XPath expressions at the same time. On those occasions, use the function :func:`~parsel.css2xpath`: diff --git a/parsel/selector.py b/parsel/selector.py index 504a4feb..0c015777 100644 --- a/parsel/selector.py +++ b/parsel/selector.py @@ -73,7 +73,7 @@ def __getitem__(self, pos): def __getstate__(self): raise TypeError("can't pickle SelectorList objects") - def xpath(self, xpath, namespaces=None, **kwargs): + def xpath(self, query, namespaces=None, **kwargs): """ Call the ``.xpath()`` method for each element in this list and return their results flattened as another :class:`SelectorList`. @@ -90,7 +90,7 @@ def xpath(self, xpath, namespaces=None, **kwargs): selector.xpath('//a[href=$url]', url="http://www.example.com") """ - return self.__class__(flatten([x.xpath(xpath, namespaces=namespaces, **kwargs) for x in self])) + return self.__class__(flatten([x.xpath(query, namespaces=namespaces, **kwargs) for x in self])) def css(self, query): """