W3C home > Mailing lists > Public > www-forms@w3.org > September 2001

using <switch> in the more traditional sense

From: Ryan Tomayko <ryant@mad.scientist.com>
Date: Tue, 4 Sep 2001 17:08:18 -0400
To: <www-forms@w3.org>
Message-ID: <000301c13585$b91c80e0$3a271841@SPOCK>

Is there currently anyway that a <switch> element can be used in the more
programming language traditional sense? For instance, let's suppose I wanted
to display a section of markup based on whether some value in my instance
document was set to 1, 2, or something else.

<xf:switch id="sw" ref="foo/bar/showit" default="def">
	<xf:case test="1" id="case1">
		...
	</xf:case>
	<xf:case test="2" id="case2">
		...
	</xf:case>
	<xf:case id="def">
		...
	</xf:case>
</xf:switch>

This would be equivelant to something that looked like this in Java:

switch(value) {
    	case 1:
		doSomething();
		break;
	case 2:
		doSomethingElse();
		break;
	default:
		doDefault();
}

I realize that there is no test attributes defined for case elements, so how
would I implement this functionality using a <toggle>? Also, what is the
value of having single-node-binding attributes on a <switch> element if this
is not possible?

Thanks,
- Ryan
Received on Tuesday, 4 September 2001 17:16:03 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Saturday, 10 March 2012 06:21:49 GMT