Hi Mark, Well, that assumes that the used prefix really always is ‘xlink’, and not for instance ‘xl’. If you want to match both at the same time, I’d go with the declare approach, and maybe use something like:
$article//(@xlink:href, @fakexlink:href) Cheers, Geert From: Danny Sinang <[email protected]<mailto:[email protected]>> Reply-To: MarkLogic Developer Discussion <[email protected]<mailto:[email protected]>> Date: Tuesday, April 14, 2015 at 7:44 PM To: MarkLogic Developer Discussion <[email protected]<mailto:[email protected]>> Subject: Re: [MarkLogic Dev General] Same prefix, different namespace URI Thanks Geert, that should work. Someone else suggested I do this : let $ns-uri := fn:namespace-uri-for-prefix("xlink", $related-article) let $doi := fn:data($related-article/@*[namespace-uri()=$ns-uri and local-name()="href"]) On Tue, Apr 14, 2015 at 2:41 PM, Geert Josten <[email protected]<mailto:[email protected]>> wrote: Just define the first as fakexlink, and use that prefix instead, that should still match: xquery version "1.0-ml"; declare namespace fakexlink = "xlink"; declare namespace xlink = "http://www.w3.org/1999/xlink"; let $xml := <test> <fakelink xmlns:xlink="xlink" xlink:href="fakeurl"/> <reallink xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="realurl"/> </test> return $xml//@fakexlink:href Cheers, Geert From: Danny Sinang <[email protected]<mailto:[email protected]>> Reply-To: MarkLogic Developer Discussion <[email protected]<mailto:[email protected]>> Date: Tuesday, April 14, 2015 at 7:15 PM To: general <[email protected]<mailto:[email protected]>> Subject: [MarkLogic Dev General] Same prefix, different namespace URI I noticed my queries weren't consistently returning the values for the "xlink:href" attribute. On close inspection, I discovered some docs declared the "xlink" namespace like this : xlink="xlink" while other docs declared them like this : xlink="http://www.w3.org/1999/xlink" Normally, I just have one "declare namespace" statement at the top of my query. But having two possible definitions for the same prefix has got me stuck. Any ideas on how to get around this ? Regards, Danny _______________________________________________ General mailing list [email protected]<mailto:[email protected]> Manage your subscription at: http://developer.marklogic.com/mailman/listinfo/general
_______________________________________________ General mailing list [email protected] Manage your subscription at: http://developer.marklogic.com/mailman/listinfo/general
