xsl-list
[Top] [All Lists]

[xsl] Evaluating condition strings

2007-04-28 09:45:09
Hi!

I've got a XML doc which contains a description of a final document. This XML doc uses tags that handle conditions:

<if condition="var1 = true or var2 < 5 and var3 = 'ok'">
 <then>
     text
 </then>
 <else>
    another text
 </else>
</if>

the variables are available in another XML doc:
<attributes>
 <variable name="var1">false</variable>
 <variable name="var2">4</variable>
 <variable name="var3">ok</variable>
</attributes>

I think I could evaluate the conditions by writing an extension for the xslt processor (I'm using Xalan-J) or parsing the conditions before the transformation process (maybe with a dynamic language like groovy because the variables are not typed.).

Could it be done with pure XSLT? What approach would you recommend?

TIA

 Martin


--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

<Prev in Thread] Current Thread [Next in Thread>