Re: Need help on using Math Functions

Florent Georges <[email protected]> Fri, 18 May 2007 11:36:03 +0200 (CEST)
Newsgroups gmane.text.xml.xslt.extensions
Message-ID <[email protected]>
"Ngo, Cathy T CIV NSWCCD W. Bethesda, 2230" wrote:

  Hi

> The error that I got as "Microsoft JScript runtime error
> Wrong number of arguments or invalid property assignment
> line = 2, col = 20 (line is offset ...". I tried to call
> math function at xsl:stylesheet section

> <xsl:variable name="price" select="catalog/cd/price[position()=1]" />
> <xsl:variable name="value" select="math:sqrt($price)" />

  $price contains all the price elements that are the first
price element within their cd parent element.  So with your
sample input, $price will contain a node-set with *two*
elements.

  math:sqrt <http://www.exslt.org/math/functions/sqrt/index.html>
takes one (and only one) number in argument.  So your error.

  It is like you want in the for-each to take the price
element of the current cd element instead:

    <xsl:for-each select="catalog/cd">
      <xsl:value-of select="price"/>
      <xsl:value-of select="math:sqrt(price)"/>
    </xsl:for-each>

  Regards,

--drkm





















	

	
		
___________________________________________________________________________ 
Découvrez une nouvelle façon d'obtenir des réponses à toutes vos questions ! 
Profitez des connaissances, des opinions et des expériences des internautes sur Yahoo! Questions/Réponses 
http://fr.answers.yahoo.com