Can I do this without the variable?
This is an open discussion with 4 replies, filed under XSLT.
Search
It took me a while too back then. Somebody eventually hinted me at the current()
function. :-)
<xsl:template match="laatste-themadossier-berichten/entry"> <xsl:value-of select="/data/themadossiers/entry[@id=current()/themadossier/item/@id]/klein/@path" /> </xsl:template>
Great, thanks :) Am I correct that you want to avoid variables as much as possible?
I actually like using $var
when it saves a big XPATH expression, makes it much more readable. I don't think there's any huge disadvantages really, but it would not be always necessary.
Also, is ./
not a shorter alias for current()/
?
Also, is
./
not a shorter alias forcurrent()/
?
Depends of context. In this case it's not the same thing. Read this.
Create an account or sign in to comment.
I have this:
When I replace the $themadossier-id with the select statement this won't work. Why is that? Do I really need to use that variable?