Altova Mailing List Archives>Archive Index >comp.text.xml Archive Home >Recent entries >Thread Prev - Mimicking a SELECT/CASE statement using XSL [Thread Next] Re: Mimicking a SELECT/CASE statement using XSLTo: NULL Date: 5/5/2004 12:32:00 PM In addition to Patrick's comments, it's worth adding that XSLT follows what's known as a "functional programming" paradigm, very different to procedural programming (mainly in that variables can't be updated which at first seems crazy to a traditional programmer) If you aren't familiar with functional programming, I'd recommend you try and get your head round these concepts so you can understand how to use recursion in templates (Jeni Tennision's "beginning XSLT" is very good book but I'm sure there are others) Andy "Gadrin77" <gadrin7@a...> wrote in message news:ffa5071b.0405030927.1c089691@p...... > as a newbie to XSL, is it possible to mimic a SELECT/CASE statement > using > XSL? > > I tried a quickie and I kept getting errors either using PARAM or > WITH-PARAM > in the wrong place or VARIABLE. I ended up using .createProcessor and > doing > all the work behind the scenes in my programming language, then using > the > .addParameter to pass the values. > > I wanted to select data, then set variables using XSL:CHOOSE and > XSL:IF based > on the values found in the data, then further alter these farther down > in the XSL with math. > > pseudo-code: > > xml: > <main class="1"> > > XSL Logic... > > if class == 1 > > xsl-var1 = 10 > xsl-var2 = 20 > > else > > xsl-var1 = 50 > xsl-var2 = 60 > > endif > > myNewNumber = "value-of xsl-var1 + value-of xsl-var2" > > 'convert myNewNumber to kilograms (was pounds) > > myNewNumber = myNewNumber * 2.2 > > etc, etc. > > I'm not sure the value of a XSL:VARIABLE can be redefined. > > sorry for the fuzziness, any help is greatly appreciated. | ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
