Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > XML > calculate number

Reply
Thread Tools

calculate number

 
 
=?ISO-8859-1?Q?Frederik_S=F8rensen?=
Guest
Posts: n/a
 
      02-07-2005

I'm trying to do this calculation in xsl but i get an error message:
"expression is not a node set"

<xsl:variable name="height" select="round(130/width*height)+10"/>

How do i save the result from this calculation in my variable?

height and width im my xml contains the height and width of an image.

Frederik
 
Reply With Quote
 
 
 
 
Richard Tobin
Guest
Posts: n/a
 
      02-07-2005
In article <420768ea$0$627$(E-Mail Removed)>,
Frederik Sørensen <(E-Mail Removed)> wrote:

>I'm trying to do this calculation in xsl but i get an error message:
>"expression is not a node set"
>
><xsl:variable name="height" select="round(130/width*height)+10"/>


The division operator is "div", not "/".

The error message reflects the fact that you are trying to find the
<width> children of 130.

-- Richard
 
Reply With Quote
 
 
 
 
=?ISO-8859-1?Q?Frederik_S=F8rensen?=
Guest
Posts: n/a
 
      02-07-2005
Works like a charm
Thanks for the very fast reply.

Frederik

Richard Tobin wrote:
> In article <420768ea$0$627$(E-Mail Removed)>,
> Frederik Sørensen <(E-Mail Removed)> wrote:
>
>
>>I'm trying to do this calculation in xsl but i get an error message:
>>"expression is not a node set"
>>
>><xsl:variable name="height" select="round(130/width*height)+10"/>

>
>
> The division operator is "div", not "/".
>
> The error message reflects the fact that you are trying to find the
> <width> children of 130.
>
> -- Richard

 
Reply With Quote
 
Malte
Guest
Posts: n/a
 
      02-07-2005
Frederik Sørensen wrote:
>
> I'm trying to do this calculation in xsl but i get an error message:
> "expression is not a node set"
>
> <xsl:variable name="height" select="round(130/width*height)+10"/>
>
> How do i save the result from this calculation in my variable?
>
> height and width im my xml contains the height and width of an image.
>
> Frederik


From a current project:

<xsl:value-of select="format-number(translate(((($upris - $ipris) * 100)
div $upris),',','.'), '#.##0,0', 'european' )"/>

As you can see, your variable best sport a '$' or they're not variables
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How do you calculate elapsed number of days Anjum Java 3 12-16-2006 06:20 PM
Calculate the week number of a Quarter? Has anybody done this? Steve Kershaw ASP .Net 0 11-22-2006 04:30 PM
Easiest way to calculate number of character in string P. Schmidt-Volkmar Python 7 12-21-2005 03:43 PM
calculate approx of decimal number ?.. mark C++ 3 06-14-2004 01:00 PM
K&R chapter 6.3 Question 'how to calculate the number of array elements' Herrcho C Programming 6 02-20-2004 08:56 PM



Advertisments