If your "$query ..." returns the XML you show below , then 

   $docs/interface/@id

 

will return 2 @id attributes.

 

Please show us your query and what you would like the  result to look
like.

I suspect the problem is in the query not the return statement but I'm
not sure exactly what XML you'd like to be returned.

 

 

 

 

From: [email protected]
[mailto:[email protected]] On Behalf Of Tony
Mariella
Sent: Tuesday, December 08, 2009 8:34 AM
To: [email protected]
Subject: [MarkLogic Dev General] Return Attribute Data

 

If I run a Marklogic Query, I would like to return specific data from
the XML.
If the XML in the DB looks like this:
 
<results>
    <interface id="345">
        <description>Test Interface A</description>
    </interface>
    <interface id="678">
        <description>Test Interface A</description>
    </interface>
</results>
 
I would like to only return the id attribute and description of the
interface tag
 
I have tried doing something like this:
 
$query...
 
return
<item>
    {$docs/interface/@id <mailto:%7b$docs/interface/@id> }
    {$docs/interface/description}
</item>
 
But i get an error that loks like this:
$docs/interface/@id -- Two attributes with the same name

Any ideas how I get only return the id attribute ?
 
-Tony Mariella

 

 

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

Reply via email to