[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Evaluating condition strings

Subject: Re: Evaluating condition strings
From: "Duane Hitz" <dhitz@xxxxxxxxxxxxxxxx>
Date: Sat, 28 Apr 2007 14:55:18 -0600
Re:  Evaluating condition strings
I've done this in the past by merging the two XML documents - basically inserting the specification (your attributes node) into the XML document to be processed as a child of the documentElement (that can be readily identified by name), then using XPaths to get at the variables. Post-transform, strip out the spec node (if you need to preserve or further process the XML document). Don't know the syntax for Xalan-J - but I'm assuming there's something equivilent to appendChild() and removeChild().

~Duane

----- Original Message ----- From: "Martin Heiden" <martin.heiden@xxxxxxxxxxxxx>
To: <xsl-list@xxxxxxxxxxxxxxxxxxxxxx>
Sent: Saturday, April 28, 2007 10:44 AM
Subject: Evaluating condition strings



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

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.