> <xsl:copy-of select="$roles/r:roles/r:role[@id=$role]/r:grants/r:for[@name='all']/r:action[@name='edit']/@grant"/>[color=blue]
> This xpath expression:
> $roles/r:roles/r:role[@id=$role]/r:grants/r:for[@name='all']/r:action[@name='edit']/@grant
>
>
> Gives the following error: "attribute 'grant' created after a child has been added"[/color]
The problem, here is not the Xpath, but rather the 'xsl:copy'
<xsl:copy-of select="@foo"/>
attempts to add the 'foo' attribute to the result tree. This only works when 'xsl:copy' is encapsulated with an element. e.g.
<parent>
<xsl:copy-of select="@foo"/>
</parent>
And it must be done before any child node is added to this element of the result tree.
Thus:
<parent>
<xsl:copy-of select="@foo"/>
<child/>
</parent>
will work, while
<parent>
<child/>
<xsl:copy-of select="@foo"/>
</parent>
will not.
I hope you can solve the problem now.
regards,
--
Joris Gillis (
http://www.ticalc.org/cgi-bin/acct-v...i?userid=38041)
Ceterum censeo XML omnibus esse utendum