|
[XQuery Talk Mailing List Archive Home] [By Date] [By Thread] [By Subject] [By Author] [Recent Entries] [Reply To This Message] outer forEric Robinson tracknerd2003 at yahoo.comThu Apr 23 10:49:31 PDT 2009
I was wondering if someone can help me with a xquery issue I am having. What I am trying to do is create a web page that will allow a user to enter information about what they are looking for in a xml document and return to them the xml document if it matches their criteria. I thought I had it all working till I hit an issue with missing repeatable complex types. Example of xml and xquery that works. <book> <title>Data on the web</title> <author>Dan Suciu</author> <section> <title>Introduction</title> <figure> <title>Traditional</title> <image source="csarch.gih"/> </figure> <figure> <title>Examples</title> <image source="example.gif"/> </figure> </section> <section> <title>Syntax</title> </section> </book> for $book in /book for $section in $book/section for $figure in $section/figure where ($book/author='Dan Suciu' and (($figure/title='Examples' and $section/title='Syntax) or ($figure/title='Examples' and $figure/image/@source='example.gif'))) return $book Since the xml matches the where at <figure> <title>Examples</title> <image source="example.gif"/> </figure> it returns me the enitre document like I want. Example that breaks my xquery. <book> <title>Data on the web</title> <author>Dan Suciu</author> <section> <title>Introduction</title> </section> <section> <title>Syntax</title> </section> </book> for $book in /book for $section in $book/section for $figure in $section/figure where ($book/author='Dan Suciu' and (($figure/title='Examples' or $section/title='Syntax) or ($figure/title='Examples' and $figure/image/@source='example.gif'))) return $book This will always return nothing because there is no /book/section/figure in the xml. I believe once "outer for" is implemented I will be able to do for $book in /book for $section in $book/section outer for $figure in $section/figure where ($book/author='Dan Suciu' and (($figure/title='Examples' or $section/title='Syntax) or ($figure/title='Examples' and $figure/image/@source='example.gif'))) return $book Anyone have any ideas how I could get this to work? -------------- next part -------------- An HTML attachment was scrubbed... URL: http://x-query.com/pipermail/talk/attachments/20090423/009917df/attachment.htm
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|






