Cola
Cola

Reputation: 2247

Running FLOWR on an xml variable as opposed to a xml document

I can successfully run an xquery FLOWR on an xml doc:

for $result in doc(results.xml)////sparql/results/result/binding

where $result/@name="xyz"
return $result

What if i want to run the same FLOWR on a variable instead?

for $result in $results//sparql/results/result/binding

where $result/@name="xyz"
return $result

this does not work. What's the correct syntax?

Upvotes: 0

Views: 52

Answers (1)

Michael Kay
Michael Kay

Reputation: 163322

If $results is a document node then your syntax is correct.

If $results is a URI containing the location of a document that needs to be parsed, then you want doc($results)//......

Upvotes: 1

Related Questions