- 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
Hello
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:model>
<xf:instance id="animals">
<data xmlns="">
<Animals>
<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"/>
</Animals>
</data>
</xf:instance>
</xf:model>
<xf:repeat nodeset="Animals/*">
<xf:group ref=".[name()='Cat']">
<xf:output ref="@Name">
<xf:label>Cat is </xf:label>
</xf:output>
</xf:group>
<xf:group ref=".[name()='Dog' and @CanBark='false']">
<xf:output ref="@Name">
<xf:label>Non-barking dog is </xf:label>
</xf:output>
</xf:group>
<xf:group ref=".[name()='Dog' and @CanBark='true']">
<xf:output ref="@Name">
<xf:label>Barking dog is </xf:label>
</xf:output>
</xf:group>
<xf:group ref=".[name()='Rat']">
<xf:output ref="@id">
<xf:label>Rat is </xf:label>
</xf:output>
</xf:group>
</xf:repeat>
Swithun.
Received on Monday, 2 October 2006 08:23:28 UTC