Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > XML > XSLT
Password Reminder
Register
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
XSLT General questions and answers about XSLT. For issues strictly specific to the book XSLT 1.1 Programmers Reference, please post to that forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XSLT section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old May 16th, 2004, 08:01 PM
Registered User
 
Join Date: May 2004
Location: , , Bulgaria.
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default Performing Division in XSLT... Please help..

Hi,

I am trying to do the following:

divide the value of an element, by the value of a parameter.
The paramater (size) is passed to the template from an <xsl:call-template>
It returns me only NaN...
Any ideas?

Here is the snippet:

<xsl:for-each select = "/A//B">
 <tr>
  <td><b>Percentage:</b></td>
  <td><b><xsl:value-of select="number('C[@name="aaa"') div number ($size) * 100"/></b></td>
  </tr>
</xsl:for-each>

It seems that the number() function cannot extrace the value of the element...
Any help will be appreciated!

Thanks,

Kiril.
Reply With Quote
  #2 (permalink)  
Old May 16th, 2004, 08:22 PM
Authorized User
 
Join Date: Oct 2003
Location: , PA, USA.
Posts: 22
Thanks: 0
Thanked 0 Times in 0 Posts
Default

It looks like you have a syntax error in your value-of statement:

>>
<xsl:value-of select="number('C[@name="aaa"') div number ($size) * 100"/>
<<

try:

<xsl:value-of select="number(C[@name="aaa"]) div number ($size) * 100"/>

If this doesn't work, we'll have to see a snippet of what the node "C" with the @name attribute typically contains...

cheers,

...sam


Reply With Quote
  #3 (permalink)  
Old May 16th, 2004, 08:36 PM
Authorized User
 
Join Date: Oct 2003
Location: , PA, USA.
Posts: 22
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Sorry,

syntax error in my correction :(

try this:

<xsl:value-of select="number(C[@name='aaa']) div number ($size) * 100"/>

...sam

Reply With Quote
  #4 (permalink)  
Old May 17th, 2004, 05:27 AM
Registered User
 
Join Date: May 2004
Location: , , Bulgaria.
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks, Sam.. Actually the problems was with the data - thanks for the note above - there was a text string after the number..
This works:
<xsl:value-of select="substring(number(substring-before(Action[@name='Database Size'], ' Mb')) div number($size) * 100, 1,5)"

Thanks again!

Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Division by zero Corey BOOK: Beginning Access 2003 VBA 2 April 13th, 2007 02:56 PM
Division by zero error Corey Access 4 October 20th, 2005 12:51 PM
division by zero rickjg JSP Basics 1 November 9th, 2004 08:03 AM
Division by zero error ss2003 Beginning PHP 5 January 1st, 2004 11:51 AM



All times are GMT -4. The time now is 12:23 AM.


Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.