if self.document is not None:
            # if a document is specified, add it it to the top-level query xpath
            # -- document takes precedence over collection
            document_xquery = 'doc("%s")' % self.document
            xpath_parts.append(self.prep_xpath(self.xpath, context=document_xquery))