[xquery-talk] Re: Attribute node whose parent is a document node
Pierrick Brihaye
pierrick.brihaye at free.fr
Sat Jul 9 11:53:05 PDT 2005
Hi,
Coming back to this. Thank you for your exaplanations, which make the
things clearer to me.
Pierrick Brihaye a écrit :
> I'm also really surprised that an element's *content* may generate an attribute
> for this element. It should IMHO generate an error *except* if a construct
> similar to <xsl:attribute> is used.
When I use :
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>
My first understanding was that we have an <xsl:value-of> behaviour. It
appears that we are a behaviour which is closer to <xsl:copy-of>. I can
figure this out this way :
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>some text{ $a/county/district/town/@name }</attribute>
... which returns a clean explanation :
XTDE0420: Attribute nodes must be created before the children of an
element node
[BTW : we could have a message giving the (attribute) node's name]
Cheers,
p.b.
More information about the talk
mailing list