Open
Description
If the string value of an XML path is always an integer …
index:facets('factbook')//
element[@name = 'country']/
attribute[@name = 'population']
… a numeric comparison …
db:open('factbook')//country[@population = 3249136]
… can be rewritten for index access:
db:attribute('factbook', '3249136')/self::attribute(population)/parent::country
Simple range queries could be rewritten as well:
db:open('factbook')//city/population
[@year >= 82 and @year <= 84]
→ db:attribute('factbook', ('82', '83', '84'))/self::attribute(year)/parent::population[parent::city]