This function aims to create an XPath expression equivalent to what would be matched by the given CSS selector. The reason the translation is required is because the XML package, being a libxml2 wrapper, can only evaluate XPath expressions.
The purpose of these functions is to mimic the functionality of the querySelector and querySelectorAll functions present in Internet browsers. This is so we can succinctly query an XML tree for nodes matching a CSS selector.