Hi Srinivas,

After fixing some minor typos in your code, things work as expected:

xquery version "1.0-ml";

declare namespace xlink="http://www.w3.org/1999/xlink";;

let $sampleArticle :=
<article>
    <article-meta>
        <related-article related-article-type="companion" xlink:href="doc1" />
        <related-article related-article-type="companion" xlink:href="doc2" />
    </article-meta>
</article>

for $v in $sampleArticle//related-article/@xlink:href
return $v

Could it be that you are inserting the result in some other element structure, 
where you end up adding multiple xlink:href attributes to the same element?

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
> Srinivas Mandadapu
> Sent: donderdag 29 oktober 2009 16:56
> To: General Mark Logic Developer Discussion
> Subject: [MarkLogic Dev General] values of attributes with
> same name in Marklogic!!?
>
> All,
>
> I am having  a problem figuring out where I am going wrong
> with the below on ML:
>
> let $sampleArticle :=
> <article>
>     <article-meta>
>         <related-article related-article-type="companion"
> xlink:href="doc1" xmlns:xlink="http://www.w3.org/1999/xlink";
> <http://www.w3.org/1999/xlink> />
>         <related-article related-article-type="companion"
> xlink:href="doc2" xmlns:xlink="http://www.w3.org/1999/xlink";
> <http://www.w3.org/1999/xlink> />
>     </article-meta>
> </article>
>
> Below is my snippet trying to retrieve doc1 & doc2 values of
> attribute xlink:href
>
> for $v in
> $sampleArticle/article/article-meta/related-article/@xlink:href
>         return $v
>
> I see below error in logs:
>
> XDMP-DUPATTR: (err:XQDY0025) $v -- Two attributes with the same name
>
> Can someone educate me as to how to go about it!!?. I really
> appreciate your help.
>
> Thanks,
> Srini
>
>
>
>
>

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

Reply via email to