From: Roy W. <gar...@ya...> - 2010-01-28 13:54:28
|
Roy Walter wrote: > > > Pieter Deelen wrote: >> On Wed, Jan 27, 2010 at 5:39 PM, Roy Walter <gar...@ya...> wrote: >> >>> Pieter Deelen wrote: >>> >>>> On Wed, Jan 27, 2010 at 2:09 PM, Roy Walter <gar...@ya...> >>>> wrote: >>>> >>>> >>>>> The following query returns <data xmlns="http://www.w3.org/2005/Atom"/> >>>>> and not the return value from the function. >>>>> >>>>> xquery version "1.0"; >>>>> declare default element namespace "http://www.w3.org/2005/Atom"; >>>>> declare variable $lookup := local:make-lookup(); >>>>> declare option exist:serialize "method=html media-type=text/html"; >>>>> >>>>> declare function local:make-lookup() >>>>> { >>>>> let $departments := >>>>> >>>>> >>>>> doc("http://dev.govmonitor.com/slackwire/groups/@departments.xml")//member >>>>> let $stakeholders := >>>>> >>>>> doc("http://dev.govmonitor.com/slackwire/groups/@stakeholders.xml")//member >>>>> >>>>> return <data>{$departments}{$stakeholders}</data> >>>>> }; >>>>> >>>>> local:make-lookup() >>>>> >>>>> What should the namespace declaration look like for this to work >>>>> correctly? (The Atom namespace is required because the rest of the query >>>>> does stuff with eXist atom feeds.) >>>>> >>>>> >>>> In which namespace are the member elements from your input document? >>>> >>>> Pieter >>>> >>> Thanks Pieter, that put me on the right track :-) >>> >>> >> You're welcome. I usually avoid declaring a default namespace. Things >> can get very confusing when you try to combine multiple documents >> and/or queries with differing default namespaces. >> >> Pieter > I think my problem is that the atompub docs created by eXist have only > a default namespace declaration <entry > xmlns="http://www.w3.org/2005/Atom"></entry>. Querying external docs > (as above) and eXist atompub docs only works if I declare a namespace > and add a prefix to all the elements in my external XML docs. > > Am I understanding that correctly? > > -- Roy Or simply declare the Atom namespace in my external docs! :-) |