[xquery-talk] incomplete results

Cindy Girard clm6u at virginia.edu
Tue Nov 30 13:59:10 PST 2004


Hi.

  I have a query that is testing for a specific id attribute, then
  returning an extra attribute in the results. It appears
  to be working, except that the additional attribute (the 'n' att),
  just doesn't appear in the results. No error is issued anywhere,
  it's just not there.

  Any ideas what I can be doing wrong or how to better troubleshoot
  it? The code is listed below.

  Thanks.
  

(  and thanks to Michael, Jeni, and David Sewell for helping me fix my
  atrocious syntax problems. )




  
 -----
 - Cindy

 Cynthia M. Girard
 IATH, University of Virginia
 clm6u at virginia.edu
  


=============================================
XML snippet:
=============================================
<TEI.2 id="ppp.00271" n="1"><text>
<pb corresp="ppp.00271.010" id="leaf005r" type="recto" teiform="pb"/><head type="main-derived" teiform="head">Preface</head>

=============================================
Query snippet:
=============================================

for $entries in collection($collctn)//TEI.2[contains(., $kwds)]
   return
      (if ($entries//TEI.2/@id = "ppp.00271") then
         (
            concat ("for $entries in collection('", $collctn, "')//TEI.2[. &amp;= '*", $kwds, "*']", " return <doc>{$entries//TEI.2/@n, $entries//TEI.2/@id, $entries//text//head[1]}</doc>")
         )
      else if ($entries//TEI.2/@id = "ppp.00237") then
         (
            concat ("for $entries in collection('", $collctn, "')//TEI.2[. &amp;= '*", $kwds, "*']", " return <doc>{$entries//TEI.2/@n, $entries//TEI.2/@id, $entries//text//head[1]}</doc>")
         )
      else if ($entries//TEI.2/@id = "ppp.00473") then
         (
            concat ("for $entries in collection('", $collctn, "')//TEI.2[. &amp;= '*", $kwds, "*']", " return <doc>{$entries//TEI.2/@n, $entries//TEI.2/@id, $entries//text//head[1]}</doc>")
         )
      else
         (
            concat ("for $entries in collection('", $collctn, "')//TEI.2[. &amp;= '*", $kwds, "*']", " return <doc>{$entries//TEI.2/@id, $entries//text//head[1]}</doc>")
         ))

=============================================
Results snippet:
=============================================


        <query>
for $entries in collection('/db/whitman/')//TEI.2[. &= '*terror*'] return <doc>{$entries//TEI.2/@id, $entries//text//head[1]}</doc> for $entries in collection('/db/whitman/')//TEI.2[. &= '*terror*'] return <doc>{$entries//TEI.2/@n, $entries//TEI.2/@id, $entries//text//head[1]}</doc> for $entries in collection('/db/whitman/')//TEI.2[. &= '*terror*'] return <doc>{$entries//TEI.2/@n, $entries//TEI.2/@id, $entries//text//head[1]}</doc> </query>

        <result>

        <doc id="per.00008">
<head type="mainauthorial"> O STAR OF FRANCE!</head>
</doc>

        <doc id="ppp.00271">
<head type="mainderived" teiform="head">Preface</head>
</doc>


        <doc id="ppp.00237">
<head type="authorial">POET.</head>
</doc>


</result>





More information about the talk mailing list