[xsl] Please help me if u can. XSLT functional programming

Subject: [xsl] Please help me if u can. XSLT functional programming
From: "Marcus Dickerhof" <marcus.dickerhof@xxxxxx>
Date: Tue, 3 Jun 2003 01:07:30 +0200
Hello,
I am new to XSLT and the art of functional programming.
As one of my first tasks I want to write a kind of interpreter. My XML input
file will like similar to this:


<EQUATION>
    <ID>X</ID>
    <EXPRESSION>
        <MULT>
            <NUMBER>6</NUMBER>
            <EXPRESSION>
                <PLUS>
                    <NUMBER>3</NUMBER>
                    <NUMBER>4</NUMBER>
                </PLUS>
            </EXPRESSION>
        </MULT>
    </EXPRESSION>
</EQUATION>


This means X=6*(3+4)

I want to write at XSLT-Stylesheet that calculates the result and writes it
to a xml file


<RESULT>
    <ID>X</ID>
    <VALUE>42</VALUE>
</RESULT>

Later I also want to include conditional (if-else etc) expressions.

Now I am used to programming Java etc. I was schocked to notice that it is
not possible to change variables. I am used to recursion in Java but there I
am used to the fact that methods can return values. I guess I have to change
my whole way of thinking.
Well I have heard of the Xalan Extensions etc, which allow assigning new
values to variables. I guess this would be a workaround. But now I have read
in so many postings that this is no nice style, besides its being
proprietary. So can anybody please help me to write a nice recursive
stylesheet that can do this? Any hints? Please.

Thank you very much in advance
Marcus Dickerhof




 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread