How to get setVariable value back [message #8018] |
Wed, 28 March 2007 10:46  |
Eclipse User |
|
|
|
Originally posted by: evaandoli.dodo.com.au
Using the setVariable seems to comes out blank when used later on.
I guessing its the way Im reading it back (using {} maybe).
Example Jet is below:
<c:setVariable var="className" select="HelloClass"/>
private {$className} <c:get select="lowercaseFirst($node/@tag)" />;
|
|
|
|
|
|
|
|
Re: How to get setVariable value back [message #9841 is a reply to message #8392] |
Mon, 02 April 2007 08:12  |
Eclipse User |
|
|
|
Stu:
A quick fix: a minor tweak to your code:
<%-- I added spaces in select= for clarity. The essentail difference is the
single quotes around 'HelloClass' --%>
<c:setVariable var="className" select=" 'HelloClass' "/>
An explanation: Without the single quotes, the XPath engine is evaluating
the expression HelloClass, which is equivalent to
../HelloClass. With JET, . maps to the "document", so this is equivalent to
/HelloClass. Odds are that you don't have
an element HelloClass at the root of you input, so className gets set to an
empty node set. The fix makes HelloClass a string - your code should now
work.
FYI: The XPath language can represent boolean, string and numeric values as
well as 'path expressions'. You can set XPath variables to contain any of
these:
<c:setVariable var="vNum" select=" 3 + 6"/>
<c:setVariable var="vString" select=" 'a String' "/>
<c:setVariable var="vBoolean" select=" 3 + 6 = 9 "/>
Paul
"Stu" <evaandoli@dodo.com.au> wrote in message
news:euggo6$vdf$1@build.eclipse.org...
>I had tried the <c:get /> :-
> <c:setVariable var="className" select="HelloClass"/>
>
> private <c:get select="$className"/>;
>
> But get the following error:
>
> templates/dump.jet(4,9): <c:get select="$className">
>
> Error: XPath expression returned no result
>
> Stuart
>
> "Paul Elder" <pelder@ca.ibm.com> wrote in message
> news:eugdb5$6rq$1@build.eclipse.org...
>> Try:
>>
>> private <c:get select="$className"/> <c:get
>> select="lowercaseFirst($node/@tag)" />;
>>
>> Dynamic XPath expression {$className} only work within attributes of an
>> JET tag (since you can't but a tag with in a tag).
>>
>> I am considering doing something like:
>>
>> private {$className} <c:get select="lowercaseFirst($node/@tag)" />;
>>
>> But I don't think I can safely use { and } as delimiters - they appear
>> too often in static text.
>>
>> My favourite alternative at this point is:
>>
>> private {{$className}} <c:get select="lowercaseFirst($node/@tag)" />;
>>
>> I don't think I'll get it in for this release, though. I have submitted a
>> bugzilla on the idea
>> (https://bugs.eclipse.org/bugs/show_bug.cgi?id=179978). Feel free to add
>> your comments.
>>
>> Paul
>>
>> "Stu" <evaandoli@dodo.com.au> wrote in message
>> news:eudv42$v0c$1@utils.eclipse.org...
>>> Using the setVariable seems to comes out blank when used later on.
>>>
>>> I guessing its the way Im reading it back (using {} maybe).
>>>
>>> Example Jet is below:
>>>
>>> <c:setVariable var="className" select="HelloClass"/>
>>>
>>> private {$className} <c:get select="lowercaseFirst($node/@tag)" />;
>>>
>>>
>>>
>>>
>>>
>>
>>
>
>
|
|
|
Powered by
FUDForum. Page generated in 6.75451 seconds