Ashutosh Chauhan wrote:
> Dear All,
>
> Since, ex:if-exists doesnt satisfy our needs we plunged into sources
> of exhibit and  stumbled upon ex:if , which seems to be quite useful.
> However, I couldnt find any examples of it on the wiki and elsewhere.
> I am curious to know if any 'if-else' kind of construct is possible?
>   
It's something like this:

    <span ex:if=".age < 10">
       <span>kid</span>
       <span ex:if=".age < 20">
          <span>teenager</span>
          <span>adult</span>
       </span>
    </span>

The first inner element is used if the condition is true, otherwise, the 
second element is used.

You can also use ex:select

    <span ex:select=".doors">
       <span ex:case="4">sedan</span>
       <span ex:case="2">coup</span>
       <span>can't be classified by number of doors</span>
    </span>

You can also use "if" inside attributes:

    <div ex:background-style-content="if(.sold = 'true', '#eee', 
'white')">...</div>

    <img ex:src-subcontent="http://foo.com/{{if(.sold = 'true', 'sold', 
'for-sale')}}.png" />

David

_______________________________________________
General mailing list
[email protected]
http://simile.mit.edu/mailman/listinfo/general

Reply via email to