[xquery-talk] Re: Attribute node whose parent is a document node

Howard Katz howardk at fatdog.com
Thu Jul 7 17:08:18 PDT 2005


 
 > -----Original Message-----
 > From: talk-bounces at xquery.com 
 > [mailto:talk-bounces at xquery.com] On Behalf Of Pierrick Brihaye
 > Sent: Thursday, July 07, 2005 2:31 PM
 > To: talk at xquery.com
 > Subject: [xquery-talk] Re: Attribute node whose parent is a 
 > document node

 [ snip ... ]

 > Any hint on my <attribute>{$a/county/district/town/@name}</attribute>
 > processing ?

[ from an earlier email ... ]
> Where does <attribute name="Aylesbeare"/> come from ?

That's interesting. To recap (and simplify) the piece of code that's
producing the result you're getting:

let $a :=
<root>
<county name="Devon">
     <district name="East Devon">
         <town name="Axminster" pct="East Devon">
             <town name="Abbey Gate"/>
          </town>
         <town name="Aylesbeare" pct="East Devon"/>
     </district>
</county>
</root>

return
<attribute>{ $a/county/district/town/@name }</attribute>

Your code is trying to return the two @name attributes that are reachable
via the given path. These are then getting "hoisted" as attributes into the
newly constructed <attribute> element containing them. 

The latest version of the spec says that having duplicate attributes (ie
attributes of the same name, something not permitted in xml) in a direct
element constructor should raise a static error. Saxon leniently resolves
the issue by simply picking the second of the two ("Aylesbeare"), while
Galax even more accomodatingly accepts both:

<attribute name="Axminster" name="Aylesbeare"/>

Mark Logic, tho operating under an older spec, says "XML Parsing Error:
duplicate attribute", which seems to be in accord with the latest version of
the wd.

Anyone disagree with how I'm reading the spec?

Howard



More information about the talk mailing list