[XQZone General] query works in use cases demo screen, not in xqy file

McBeath, Darin W (ELS-AMS) D.McBeath at elsevier.com
Thu May 11 10:22:34 PDT 2006


I would suspect this has to do with the default namespace of
xmlns=http://www.w3.org/1999/xhtml <http://www.w3.org/1999/xhtml> .

 

recipeml, etc. would not be defined in this namespace.

 

 

  _____  

From: general-bounces at xqzone.marklogic.com
[mailto:general-bounces at xqzone.marklogic.com] On Behalf Of DuCharme, Bob
Sent: Thursday, May 11, 2006 1:04 PM
To: general at xqzone.marklogic.com
Subject: [XQZone General] query works in use cases demo screen, not in xqy
file

 

I've loaded some data into MarkLogic (see
http://www.xml.com/pub/a/2005/03/02/xquery.html for more on the data), and
the following works fine from http://localhost:8000/use-cases/:

 

 for $doc in collection('recipes')

    where $doc/recipeml/recipe/head/yield > 20

    return $doc/recipeml/recipe/head/title/text()

 

 

The following script, however doesn't work: 

 

  <html xmlns="http://www.w3.org/1999/xhtml">

  <head><title>Food for a Crowd</title></head>

  <body>

    <h1>Food for a Crowd</h1>

    { 

      for $doc in collection('recipes')

  (:   where $doc/recipeml/recipe/head/yield > 20 :)

 

      return

        <p><a href="{document-uri($doc)}">

        {$doc/recipeml/recipe/head/title/text()}

        </a></p>

        }

  </body></html>

 

(I commented out the WHERE clause to simplify it.) The titles are not
showing up. The output of the for loop looks like this:

 

<p><a href="c:/dat/xquery/recipeml/_Mexican_Five_Layer_Dip_.xml"></a></p>

<p><a href="c:/dat/xquery/recipeml/Walnut_Squares.xml"></a></p>

<!-- etc. -->

 

(If I don't comment out the WHERE clause, I don't even get the "a"
elements.) Why would "return $doc/recipeml/recipe/head/title/text()" work in
an ad hoc query from the use cases screen but not from within a script? 

 

thanks,

 

Bob DuCharme

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://xqzone.marklogic.com/pipermail/general/attachments/20060511/98f48b15/attachment.html


More information about the General mailing list