Project

Profile

Help

outer for

Added by Anonymous about 15 years ago

Legacy ID: #7264625 Legacy Poster: tracknerd (tracknerd2003)

Is there a version of saxon that supports the "outer for" from the XQuery 1.1 W3C Working Draft 3 December 2008?


Replies (8)

Please register to reply

RE: outer for - Added by Anonymous about 15 years ago

Legacy ID: #7264641 Legacy Poster: Michael Kay (mhkay)

Not yet. Saxon 9.2 will support it with some restrictions.

RE: outer for - Added by Anonymous about 15 years ago

Legacy ID: #7264667 Legacy Poster: tracknerd (tracknerd2003)

Is there a way of doing a "outer for" using diff syntax in saxon?

RE: outer for - Added by Anonymous about 15 years ago

Legacy ID: #7264722 Legacy Poster: Michael Kay (mhkay)

Sure. "outer for" is just syntactic sugar, isn't it, for something like for $d in department return if (exists($d/employee) then for $e in $d/employee return ... else ...

RE: outer for - Added by Anonymous about 15 years ago

Legacy ID: #7264949 Legacy Poster: tracknerd (tracknerd2003)

I currently have something like for $d in document, $e in $d/this, $j in $d/other where $e/field1 = "ok" or $j/field1 = "ok" return $d only issue is that the document doesn't always have $d/this or $d/other so i thought with the outer for I would be able to do for $d in document, outer for $e in $d/this outer for $j in $d/other where $e/field1 = "ok" or $j/field1 = "ok" return $d

RE: outer for - Added by Anonymous about 15 years ago

Legacy ID: #7264980 Legacy Poster: Michael Kay (mhkay)

Surely that's just for $d in document where $d/this/field1='ok' or $d/other/field1='ok' return $d or more concisely document[(this|other)/field1='ok'] I suspect you are stuck in a SQL mindset...

RE: outer for - Added by Anonymous about 15 years ago

Legacy ID: #7265271 Legacy Poster: tracknerd (tracknerd2003)

Well I had my xquery like that at first but I have xml like the following. It still works with the xquery you gave but then if I change the where to $d/document/this/field1='ok' and $d/document/other/field1='ok' I get false positives because of the repeatable document. <documents> <document> <this> <field1>ok</field1> </this> <other> <field1>not ok</field1> </other> </document> <document> <this> <field1>not ok</field1> </this> <other> <field1>ok</field1> </other> </document> </documents> And yes I am stuck in a SQL mindset. I have a webpage that dynamicly generates sql to query a DB and it generates xquery to query xml documents at the same time. The xquery just returns the entire document if it believes there is something in there that matches the users critiera.

RE: outer for - Added by Anonymous about 15 years ago

Legacy ID: #7267423 Legacy Poster: Michael Kay (mhkay)

This has turned into a pure XQuery coding discussion. There's nothing specific to Saxon about it, so you should really be using a different forum, e.g. talk @ x-query.com I'm afraid in your latest example, you've shown a query that doesn't give the result you want, but you haven't said what result you want, so I can't help you write the query.

RE: outer for - Added by Anonymous about 15 years ago

Legacy ID: #7267973 Legacy Poster: tracknerd (tracknerd2003)

I will post on x-query.com when I can give a better example and the results I am looking for. Thanks for taking the time to help.

    (1-8/8)

    Please register to reply