Until XQuery(N+1) and ML support seperate default element namespaces and 
default xpath namespaces like they do in XSLT 3.0 I encourage the last style, 
even if more work,,
ie. don't use default element namespaces if you ever have to XPath over 
something not in that namespace (and who doesn't !) .  Its more painful than 
the seeming convenience suggests.


-----------------------------------------------------------------------------
David Lee
Lead Engineer
MarkLogic Corporation
d...@marklogic.com
Phone: +1 812-482-5224
Cell:  +1 812-630-7622
www.marklogic.com<http://www.marklogic.com/>


From: general-boun...@developer.marklogic.com 
[mailto:general-boun...@developer.marklogic.com] On Behalf Of Danny Sokolsky
Sent: Thursday, October 25, 2012 1:34 PM
To: MarkLogic Developer Discussion
Subject: Re: [MarkLogic Dev General] Declare default element namespace

That does not actually search in the empty namespace.  That undeclares the 
prefix "empty".

If you want to search in no namespace after creating a default element 
namespace, you have to either use a function such as fn:QName to generate a 
QName in no namespace or do what David suggested using xmlns="" in an element 
context.

Or just don't use the default element namespace (but that is kind of an issue 
of style).

-Danny

From: general-boun...@developer.marklogic.com 
[mailto:general-boun...@developer.marklogic.com] On Behalf Of William Merritt 
Sawyer
Sent: Thursday, October 25, 2012 10:24 AM
To: MarkLogic Developer Discussion
Subject: Re: [MarkLogic Dev General] Declare default element namespace

Is there any way to declare a namespace that is equal to the empty namespace so 
you can then use it in a xpath?

Errors on empty string
declare namespace empty = "";
/empty:some-element




From: 
general-boun...@developer.marklogic.com<mailto:general-boun...@developer.marklogic.com>
 [mailto:general-boun...@developer.marklogic.com] On Behalf Of David Lee
Sent: Thursday, October 25, 2012 11:21 AM
To: MarkLogic Developer Discussion
Subject: Re: [MarkLogic Dev General] Declare default element namespace

Take that back, its a pain but try this:   Its not *exactly* what you want but 
sometimes works.
*:name resolves to all namespaces including the empty one.


xquery version "1.0-ml";
declare default element namespace "http://www.w3.org/1999/xhtml";;

let $x :=
<body><mine xmlns="">No NS></mine><p>hello world</p></body>

return $x//*:mine


-----------------------------------------------------------------------------
David Lee
Lead Engineer
MarkLogic Corporation
d...@marklogic.com<mailto:d...@marklogic.com>
Phone: +1 812-482-5224
Cell:  +1 812-630-7622
www.marklogic.com<http://www.marklogic.com/>

From: 
general-boun...@developer.marklogic.com<mailto:general-boun...@developer.marklogic.com>
 [mailto:general-boun...@developer.marklogic.com] On Behalf Of David Lee
Sent: Thursday, October 25, 2012 1:17 PM
To: MarkLogic Developer Discussion
Subject: Re: [MarkLogic Dev General] Declare default element namespace

Not to my knowledge..
I opened a W3C  XQuery feature request for this a while back

-----------------------------------------------------------------------------
David Lee
Lead Engineer
MarkLogic Corporation
d...@marklogic.com<mailto:d...@marklogic.com>
Phone: +1 812-482-5224
Cell:  +1 812-630-7622
www.marklogic.com<http://www.marklogic.com/>

From: 
general-boun...@developer.marklogic.com<mailto:general-boun...@developer.marklogic.com>
 [mailto:general-boun...@developer.marklogic.com] On Behalf Of William Merritt 
Sawyer
Sent: Thursday, October 25, 2012 1:10 PM
To: general@developer.marklogic.com<mailto:general@developer.marklogic.com>
Subject: [MarkLogic Dev General] Declare default element namespace

If you set the default element namespace with "declare default element 
namespace 'some-url'; " is there a way still xpath against the empty namespace?

Thanks,

- Will
_______________________________________________
General mailing list
General@developer.marklogic.com
http://developer.marklogic.com/mailman/listinfo/general

Reply via email to