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