<table cellspacing="0" cellpadding="0" border="0" ><tr><td valign="top" style="font: inherit;"><DIV>I was wondering if someone can help me with a xquery issue I am having.</DIV>
<DIV>&nbsp;</DIV>
<DIV>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.</DIV>
<DIV>&nbsp;</DIV>
<DIV>Example of xml and xquery that works.</DIV>
<DIV>&nbsp;</DIV>
<DIV>&lt;book&gt;</DIV>
<DIV>&nbsp; &lt;title&gt;Data on the web&lt;/title&gt;</DIV>
<DIV>&nbsp; &lt;author&gt;Dan Suciu&lt;/author&gt;</DIV>
<DIV>&nbsp; &lt;section&gt;</DIV>
<DIV>&nbsp;&nbsp;&nbsp; &lt;title&gt;Introduction&lt;/title&gt;</DIV>
<DIV>&nbsp;&nbsp;&nbsp; &lt;figure&gt;</DIV>
<DIV>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;title&gt;Traditional&lt;/title&gt;</DIV>
<DIV>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;image source="csarch.gih"/&gt;</DIV>
<DIV>&nbsp;&nbsp;&nbsp; &lt;/figure&gt;</DIV>
<DIV>&nbsp;&nbsp;&nbsp; &lt;figure&gt;</DIV>
<DIV>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;title&gt;Examples&lt;/title&gt;</DIV>
<DIV>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;image source="example.gif"/&gt;</DIV>
<DIV>&nbsp;&nbsp;&nbsp; &lt;/figure&gt;</DIV>
<DIV>&nbsp; &lt;/section&gt;</DIV>
<DIV>&nbsp; &lt;section&gt;</DIV>
<DIV>&nbsp;&nbsp;&nbsp; &lt;title&gt;Syntax&lt;/title&gt;</DIV>
<DIV>&nbsp; &lt;/section&gt;</DIV>
<DIV>&lt;/book&gt;</DIV>
<DIV>&nbsp;</DIV>
<DIV>for $book in /book</DIV>
<DIV>for $section in $book/section</DIV>
<DIV>for $figure in $section/figure</DIV>
<DIV>where ($book/author='Dan Suciu' and (($figure/title='Examples' and $section/title='Syntax) or ($figure/title='Examples' and <A href="mailto:$figure/image/@source='example.gif'">$figure/image/@source='example.gif'</A>)))</DIV>
<DIV>return $book</DIV>
<DIV>&nbsp;</DIV>
<DIV>Since the xml matches the where at </DIV>
<DIV>&lt;figure&gt;</DIV>
<DIV>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;title&gt;Examples&lt;/title&gt;</DIV>
<DIV>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;image source="example.gif"/&gt;</DIV>
<DIV>&lt;/figure&gt;</DIV>
<DIV>it returns me the enitre document like I want.</DIV>
<DIV>&nbsp;</DIV>
<DIV>Example that breaks my xquery.</DIV>
<DIV>&nbsp;</DIV>
<DIV>&lt;book&gt;</DIV>
<DIV> &lt;title&gt;Data on the web&lt;/title&gt;</DIV>
<DIV>&nbsp; &lt;author&gt;Dan Suciu&lt;/author&gt;</DIV>
<DIV>&nbsp; &lt;section&gt;</DIV>
<DIV>&nbsp;&nbsp;&nbsp; &lt;title&gt;Introduction&lt;/title&gt;</DIV>
<DIV>&nbsp;&nbsp;&nbsp;&lt;/section&gt;</DIV>
<DIV>&nbsp; &lt;section&gt;</DIV>
<DIV>&nbsp;&nbsp;&nbsp; &lt;title&gt;Syntax&lt;/title&gt;</DIV>
<DIV>&nbsp; &lt;/section&gt;</DIV>
<DIV>&lt;/book&gt;</DIV>
<DIV>&nbsp;</DIV>
<DIV>for $book in /book</DIV>
<DIV>for $section in $book/section</DIV>
<DIV>for $figure in $section/figure</DIV>
<DIV>where ($book/author='Dan Suciu' and (($figure/title='Examples'&nbsp;or $section/title='Syntax) or ($figure/title='Examples' and <A href="mailto:$figure/image/@source='example.gif'">$figure/image/@source='example.gif'</A>)))</DIV>
<DIV>return $book</DIV>
<DIV>&nbsp;</DIV>
<DIV>This will always return nothing because there is no /book/section/figure in the xml.</DIV>
<DIV>&nbsp;</DIV>
<DIV>I believe once "outer for" is implemented I will be able to do </DIV>
<DIV>&nbsp;</DIV>
<DIV>for $book in /book</DIV>
<DIV>for $section in $book/section</DIV>
<DIV>outer for $figure in $section/figure</DIV>
<DIV>where ($book/author='Dan Suciu' and (($figure/title='Examples'&nbsp;or $section/title='Syntax) or ($figure/title='Examples' and <A href="mailto:$figure/image/@source='example.gif'">$figure/image/@source='example.gif'</A>)))</DIV>
<DIV>return $book</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV>Anyone have any ideas how I could get this to work?</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV></td></tr></table><br>