|
Re: why require a var definition in a loop? [message #39783 is a reply to message #39165] |
Tue, 15 January 2008 14:36 |
Paul Elder Messages: 849 Registered: July 2009 |
Senior Member |
|
|
Felix:
When I was designing the tags, I considered and rejected this. I decided
that readers of the template would then have to figure out the context of
many expressions by looking more widely at the template. My goal was to keep
JET templates really simple to understand, and after coding a number of
templates both ways, I decided that while changing the context resulted in
shorter XPath expressions, it also resulted in templates that seemed
considerably more mysterious.
If you feel strongly about having such a feature, feel free to submit a
bugzilla. Even better, attach a patch with the implementation.
But I wonder whether this is not so much about the compactness of the XPath
expression, and more about the verbosity of c:get? I have a submitted:
https://bugs.eclipse.org/bugs/show_bug.cgi?id=179978
Which suggests have having something like {{$currNode/@name}} as an
alternative to <c:get select="$currNode/@name"/>. How would that effect
your view of the article's code?
Thanks for your interest,
Paul
"Felix Dorner" <felix_do@web.de> wrote in message
news:20080111003820.1ff8c8b3@serenity...
> Hey,
>
> a sample from the "create better code with jet article":
>
> <c:iterate select="/app/person" var="currNode" delimiter="," >
> Name = <c:get select="$currNode/@name" />
> </c:iterate>
>
> wouldnt it be cooler to have an implicit context node (I have seen this
> in xpath/xslt or xquery, not sure...), like this:
>
> <c:iterate select="/app/person delimiter="," >
> <-- context is now a person node that has a name attribute -->
> Name = <c:get select = @name>
> </c:iterate>
>
>
> This doesn't seem to work however.
>
>
>
> Felix
>
>
>
>
>
|
|
|
|
Powered by
FUDForum. Page generated in 0.23724 seconds