[xquery-talk] Re: Attribute node whose parent is a document node
Pierrick Brihaye
pierrick.brihaye at free.fr
Thu Jul 7 23:50:04 PDT 2005
Hi,
Wolfgang Hoschek a écrit :
> "top-level" node = parentless node
> See item 7 at http://www.w3.org/TR/xslt-xquery-serialization/#serdm
Sorry, Im really stuck here. *who* has no parent ? The node in the for
statement ($town) ?
BTW, having tried this :
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>
let $b :=
for $town in $a/county/district/town
where ($town/../@name eq "East Devon")
return $town
let $c :=
for $town in $a/county/district[@name = "East Devon"]/town
return $town
return
(<attribute>{$a/county/district/town/@name}</attribute>,$b,<blah/>,$c)
... I get :
<?xml version="1.0" encoding="UTF-8"?>
<attribute name="Aylesbeare"/>
<town pct="East Devon" name="Axminster">
<town name="Abbey Gate"/>
</town>
<town pct="East Devon" name="Aylesbeare"/>
<blah/>
<town pct="East Devon" name="Axminster">
<town name="Abbey Gate"/>
</town>
<town pct="East Devon" name="Aylesbeare"/>
Where does <attribute name="Aylesbeare"/> come from ?
Cheers,
p.b.
More information about the talk
mailing list