Skip to main content



      Home
Home » Modeling » M2T (model-to-text transformation) » simple IF .. ELSE statement
simple IF .. ELSE statement [message #24064] Wed, 27 June 2007 10:11 Go to next message
Eclipse UserFriend
Hello,
JET has a <c:if> tag but not a "else" one. I'm using it to verify that a
reference exists and I'd like to know how to do simply the ELSE case:

<c:if test="$currClass/myreference">
<%-- reference exists --%>
</c:if>
else ?
<%-- reference doesn't exists --%>


Thank you,
Tex.
Re: simple IF .. ELSE statement [message #24088 is a reply to message #24064] Thu, 28 June 2007 03:47 Go to previous messageGo to next message
Eclipse UserFriend
Hello,

I already had this problem and you should maybe use <c:choose...> tag :

<c:choose>
<c:when test="[insert your 'if' condition here]">
handle case 1
</c:when>
<c:otherwise>
handle other cases
</c:otherwise>
</c:choose>

Hope it helps.

Aleks
Re: simple IF .. ELSE statement [message #24189 is a reply to message #24088] Thu, 28 June 2007 04:13 Go to previous messageGo to next message
Eclipse UserFriend
Hello,
yes I was thinking about it but it is a bit complicated just for an "else"
Isn't there an equivalent of NOT in JET ( "!" in C/C++ .. ) :
<c:if test="$currClass/myreference">
<%-- reference exists --%>
</c:if>
<c:if NOT test="$currClass/myreference">
<%-- reference doesn't exist --%>
</c:if>

Tex.

adworak wrote:
> Hello,
>
> I already had this problem and you should maybe use <c:choose...> tag :
>
> <c:choose>
> <c:when test="[insert your 'if' condition here]">
> handle case 1
> </c:when>
> <c:otherwise>
> handle other cases
> </c:otherwise>
> </c:choose>
>
> Hope it helps.
>
> Aleks
>
Re: simple IF .. ELSE statement [message #24352 is a reply to message #24189] Thu, 28 June 2007 09:53 Go to previous messageGo to next message
Eclipse UserFriend
Tex:

There is a 'not'. It is an XPath function...

<c:if test="$currClass/myreference">
<%-- reference exists --%>
</c:if>
<c:if test="not($currClass/myreference)">
<%-- reference doesn't exist --%>
</c:if>

"Tex Twil" <chaljan@hotmail.com> wrote in message
news:f5vqk9$n7t$1@build.eclipse.org...
> Hello,
> yes I was thinking about it but it is a bit complicated just for an "else"
> Isn't there an equivalent of NOT in JET ( "!" in C/C++ .. ) :
> <c:if test="$currClass/myreference">
> <%-- reference exists --%>
> </c:if>
> <c:if NOT test="$currClass/myreference">
> <%-- reference doesn't exist --%>
> </c:if>
>
> Tex.
>
> adworak wrote:
>> Hello,
>>
>> I already had this problem and you should maybe use <c:choose...> tag :
>>
>> <c:choose>
>> <c:when test="[insert your 'if' condition here]">
>> handle case 1
>> </c:when>
>> <c:otherwise>
>> handle other cases
>> </c:otherwise>
>> </c:choose>
>>
>> Hope it helps.
>>
>> Aleks
>>
Re: simple IF .. ELSE statement [message #24474 is a reply to message #24352] Thu, 28 June 2007 10:04 Go to previous message
Eclipse UserFriend
Ok,
thank you.

Paul Elder wrote:
> Tex:
>
> There is a 'not'. It is an XPath function...
>
> <c:if test="$currClass/myreference">
> <%-- reference exists --%>
> </c:if>
> <c:if test="not($currClass/myreference)">
> <%-- reference doesn't exist --%>
> </c:if>
>
> "Tex Twil" <chaljan@hotmail.com> wrote in message
> news:f5vqk9$n7t$1@build.eclipse.org...
>> Hello,
>> yes I was thinking about it but it is a bit complicated just for an "else"
>> Isn't there an equivalent of NOT in JET ( "!" in C/C++ .. ) :
>> <c:if test="$currClass/myreference">
>> <%-- reference exists --%>
>> </c:if>
>> <c:if NOT test="$currClass/myreference">
>> <%-- reference doesn't exist --%>
>> </c:if>
>>
>> Tex.
>>
>> adworak wrote:
>>> Hello,
>>>
>>> I already had this problem and you should maybe use <c:choose...> tag :
>>>
>>> <c:choose>
>>> <c:when test="[insert your 'if' condition here]">
>>> handle case 1
>>> </c:when>
>>> <c:otherwise>
>>> handle other cases
>>> </c:otherwise>
>>> </c:choose>
>>>
>>> Hope it helps.
>>>
>>> Aleks
>>>
>
>
Previous Topic:check if a variable is defined
Next Topic:get a JET variable in a scriptlet
Goto Forum:
  


Current Time: Sun May 11 04:31:48 EDT 2025

Powered by FUDForum. Page generated in 0.05380 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top