Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

XQuery: Index access for integers #2069

Open
ChristianGruen opened this issue Feb 19, 2022 · 0 comments
Open

XQuery: Index access for integers #2069

ChristianGruen opened this issue Feb 19, 2022 · 0 comments
Labels

Comments

@ChristianGruen
Copy link
Member

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]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant