W3C home > Mailing lists > Public > www-forms@w3.org > October 2006

Re: XForms: Conditional display?

From: Swithun Crowe <swithun@swithun.servebeer.com>
Date: Mon, 2 Oct 2006 09:24:01 +0100 (BST)
To: Abishek Bellamkonda <abi.bellamkonda@roadhouse.com.au>
cc: www-forms@w3.org
Message-ID: <Pine.LNX.4.64.0610020916020.3542@shadrach.swithun.servebeer.com>


AB Is there anyway where we can use a switch statement where we can display
AB the data, based on condition? Like Xsl:Choose? Ok here is what my model
AB is:

AB Now I need to list animals in sequence, each type of animal have to be
AB shown in different format. I can have any number of animals, animals can
AB be in any order.

This works in Firefox. I use xf:group elements and the @ref attribute does 
the job of case toggling.

      <xf:instance id="animals">                                                
        <data xmlns="">                                                         
            <Cat Name="cat 1"/>                                                 
            <Cat Name="cat 2"/>                                                 
            <Dog Name="My Dog 1" CanBark="false"/>
            <Dog Name="Your 1" CanBark="true"/>
            <Rat id="Something" whatever="Something"/>
    <xf:repeat nodeset="Animals/*">                                             
      <xf:group ref=".[name()='Cat']">                                          
        <xf:output ref="@Name">                                                 
          <xf:label>Cat is </xf:label>                                          
      <xf:group ref=".[name()='Dog' and @CanBark='false']">
        <xf:output ref="@Name">
          <xf:label>Non-barking dog is </xf:label>
      <xf:group ref=".[name()='Dog' and @CanBark='true']">                      
        <xf:output ref="@Name">
          <xf:label>Barking dog is </xf:label>                                  
      <xf:group ref=".[name()='Rat']">                                          
        <xf:output ref="@id">                                                   
          <xf:label>Rat is </xf:label>                                          

Received on Monday, 2 October 2006 08:23:28 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 21:36:18 UTC