Your code is trying to assign all of the id attributes from all of the 
interface elements to a single "item" element-hence the "two attributes with 
the same name" error.  Instead try:

...
return
  for $if in $docs/interface
  return <item>...</item>


Doug Glidden
(703) 317-7523
http://dougglidden.blog.boeing.com<http://dougglidden.blog.boeing.com/>



  _____

From: [email protected] 
[mailto:[email protected]] On Behalf Of Tony Mariella
Sent: Tuesday, December 08, 2009 08:34
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:{$docs/interface/@id>}
    {$docs/interface/description}
</item>

But i get an error that loks like this:
$docs/interface/@id<mailto:$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