xml-general mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David_N_Bert...@lotus.com
Subject Re: XSLT Question
Date Wed, 13 Dec 2000 15:42:11 GMT

There is no way in standard XSLT that you can evaluate a string as if it
were a mathematical expression.  Some processors have extension functions
which allow the evaluation of XPath expressions, but those extensions are
non-standard.

Something you could do, which is probably not what you want, is to break
the two values into two different variables.  However, you cannot put the
operator into a variable and have XPath dynamically detect the * and do the
multiplication.

Of course, you could do some sort of <xsl:choose> and have embedded XPath's
with the various operators you want to support, but that is not a general
solution like the one I think you're looking for.

Dave



                                                                                         
                         
                    Roberto                                                              
                         
                    Tiella               To:     general@xml.apache.org                  
                         
                    <tiella@sodal        cc:     (bcc: David N Bertoni/CAM/Lotus)     
                            
                    ia.it>               Subject:     XSLT Question                   
                            
                                                                                         
                         
                    12/13/2000                                                           
                         
                    09:39 AM                                                             
                         
                    Please                                                               
                         
                    respond to                                                           
                         
                    general                                                              
                         
                                                                                         
                         
                                                                                         
                         



Hi  everybody !

I have a question concerning XSLT.

I have a XML like the following:

<expr>
<value>4</value>
<operator>*</operator>
<value>7</value>
</expr>

applying a template, I'm able to assign the string "4*7" to a variable
(say 'n'). Now the question is
how can I evaluate the expression in 'n' ?

the XSLT fragment:

<xsl:value-of select="$n"/>

just returns the '4*7' string.

Is there any other way the expressior or just to get the '28' from the
XML document ?

best regards, roberto.

--
Roberto Tiella
Process Reuse And Technologies Area
SODALIA s.p.a.
v. Valentina Zambra,1 38100 TRENTO ITALY
phone: +39 0461 316430 fax: +39 0461 316401



---------------------------------------------------------------------
In case of troubles, e-mail:     webmaster@xml.apache.org
To unsubscribe, e-mail:          general-unsubscribe@xml.apache.org
For additional commands, e-mail: general-help@xml.apache.org






Mime
View raw message