Topic: wftk -- Process definition: <if>

wftk home ] [ process definition ] [ discussion ]
The conditional is coded with an <if> tag. When I first considered the idea of an XML-based if, I was really unhappy about what it should look like. First, the entire thing should be enclosed in the <if> ... </if> block. OK, fine -- but where do we put that else? Should the enclosed blocks be considered a sequence or a parallel block? Do we need a then? Obviously not, but then why have an else?

So after mulling that over a while, I decided to use the LISP cond as a model. But since the word "if" still means more to me than "cond", at least the tag is called "if".

(2/23/00) Thomas Fricke suggested a slightly different setup than the cond model I was using, and I liked it better, so I'm using it. We get the same advantage of not having heavily nested if/then/else structures as we did with my version, but it's more readable in both our opinions.

So the basic structure of the if tag is:
  <if expr="...">
    <elseif expr="..."/>
Like the iteration construction, this syntax covers basically any conditional without the need for multiple syntactic forms: you can write an if or a case equally well with it. Nesting is of course not an issue with markup languages; you always have a close-tag.

The only really open question in my mind about this construct is how to evaluate those test expressions. As noted in current email (2/12/00), the Tcl expression evaluator might be a convenient compact package to use for this purpose. As with many other open questions, my answer right now is, "we'll see when we get into prototyping." And of course, if you have any other ideas, I'd love to hear'em.

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.