>
> Strange enough:
> this works: <xsl:value-of select="./@module"/> output:files
> this does not work:
> <xsl:copy-of select="$roles/r:roles/r:role[@id=$role]/r:grants/r:for[@name=./@module]"/> output= ""
> and this does work:
> <xsl:copy-of select="$roles/r:roles/r:role[@id=$role]/r:grants/r:for[@name='files']"/>
>
> I do not understand the if test in the second template is almost the same as in the first template, but the first template always works and
> the second not..... i cannot find the error
>
Hi,
you could use this:
<xsl:copy-of select="$roles/r:roles/r:role[@id=$role]/r:grants/r:for[@name=current()/@module]"/>
Explanation:
In this Xpath expression:
<xsl:value-of select="./@module"/>
the period (.) selects the context node, which - in this case- is equal to the current node-set of the template.
But between the [brackets] in:
<xsl:copy-of select="/r:for[@name=./@module]"/>
, the context node is changed to the node preceding the left bracket ('r:for'). So this expression is trying to access the 'module' attribute of 'r:for'. In other words, you cannot access the current node-set with '.' when you're between brackets. You have to use 'current()' in stead.
regards,
--
Joris Gillis (
http://www.ticalc.org/cgi-bin/acct-v...i?userid=38041)
Ceterum censeo XML omnibus esse utendum