def attribute_query(self, metadata):
        """Extract attribute or content from a region."""
        content_field = metadata.get(u'text-content', u'content')
        attribute = metadata.get(u'attribute', content_field)
        if attribute == content_field:
            return u'self::node()'
        return u'@%s' % attribute
Extract attribute or content from a region.
slybot/slybot/plugins/scrapely_annotations/processors.py