Or alternatively, and with less typing, do the evaluation outside the element 
constructor with the default namespace:

let $doc := doc('/blah.xml')
let $mytext := $doc/one/two/text()
return
   <a xmlns="http://myns";>
     <b>{ $text }</b>
   </a>

Kind regards,
Geert

>


Drs. G.P.H. Josten
Consultant


http://www.daidalos.nl/
Daidalos BV
Source of Innovation
Hoekeindsehof 1-4
2665 JZ Bleiswijk
Tel.: +31 (0) 10 850 1200
Fax: +31 (0) 10 850 1199
http://www.daidalos.nl/
KvK 27164984
De informatie - verzonden in of met dit emailbericht - is afkomstig van 
Daidalos BV en is uitsluitend bestemd voor de geadresseerde. Indien u dit 
bericht onbedoeld hebt ontvangen, verzoeken wij u het te verwijderen. Aan dit 
bericht kunnen geen rechten worden ontleend.


> From: [email protected]
> [mailto:[email protected]] On Behalf Of
> Danny Sokolsky
> Sent: maandag 23 maart 2009 18:51
> To: General Mark Logic Developer Discussion
> Subject: RE: [MarkLogic Dev General] quick namespace question
>
> You can put your XPath in a function call--that way it will
> not have a parent namespace to inherit.  Something like this:
>
> xquery version "1.0-ml";
>
> declare function local:get-xpath($node as node()) as node()*
> { $node/one/two/text() };
>
> let $doc := doc('/blah.xml')
> return
>    <a xmlns="http://myns";>
>      <b>{ local:get-xpath($doc) }</b>
>    </a>
>
> -Danny
>
> -----Original Message-----
> From: [email protected]
> [mailto:[email protected]] On Behalf Of
> Eric Palmitesta
> Sent: Monday, March 23, 2009 10:38 AM
> To: General Mark Logic Developer Discussion
> Subject: Re: [MarkLogic Dev General] quick namespace question
>
> Typo, <a xmlns="http://some/namespace";><b/></a> should be <a
> xmlns="http://myns";><b/></a>.
>
> EP
>
> Eric Palmitesta wrote:
> > I feel like I've seen this on the list already, but I can't seem to
> find
> > the discussion.
> >
> > The document '/blah.xml' contains no namespaces.
> >
> > xquery version "1.0-ml";
> > let $doc := doc('/blah.xml')
> > return
> >   <a xmlns="http://myns";>
> >     <b>{ $doc/one/two/text() }</b>
> >   </a>
> >
> > This query statement will result in <a
> > xmlns="http://some/namespace";><b/></a>, because the xpath is looking
> for
> > one and two in the "http://myns"; namespace.
> >
> > I could (have) declare(d) an empty namespace (pre-ML4, I think),
> > something like...
> >
> > declare namespace none = ""
> >
> > ...and do $doc/none:one/none:two/text().  However, I believe since
> ML4,
> > I'd get an "XDMP-UNBPRFX: (err:XPST0081) Prefix none has no
> namespace
> > binding" error.
> >
> > How can I get at the no-namespace elements of a document, within an
> > element with a default namespace?  Is $doc/*:one/*:two/text() the
> Right
> > Way (tm)?
> >
> > Cheers,
> >
> > Eric
> > _______________________________________________
> > General mailing list
> > [email protected]
> > http://xqzone.com/mailman/listinfo/general
> _______________________________________________
> General mailing list
> [email protected]
> http://xqzone.com/mailman/listinfo/general
> _______________________________________________
> General mailing list
> [email protected]
> http://xqzone.com/mailman/listinfo/general
>

_______________________________________________
General mailing list
[email protected]
http://xqzone.com/mailman/listinfo/general

Reply via email to