Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: Mimicking a SELECT/CASE statement using XSL

From: "Andy Fish" <ajfish@----------.--.-->
To: 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.




transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent