Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XSLT
|
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 software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old August 28th, 2010, 03:25 AM
Authorized User
 
Join Date: Jul 2010
Posts: 27
Thanks: 6
Thanked 0 Times in 0 Posts
Default Convert from string to number

I have the source
<g transform="translate(0 0) scale(0.4)" >

My expression like this:
<xsl:variable name="s" select="number(substring-before(substring-after(@transform,'scale'),')'))"/>

I wanna get the value 0.4 and multiply by a number. For instance: 100*$s

But it return NaN value
 
Old August 28th, 2010, 03:59 AM
Friend of Wrox
 
Join Date: Jun 2008
Posts: 291
Thanks: 9
Thanked 29 Times in 29 Posts
Thumbs up

Try with the below:
Code:
<xsl:variable name="s" select="number(substring-before(substring-after(@transform,'scale('),')'))"/>
I just added a '(' to 'scale'.
__________________
Rummy
 
Old August 28th, 2010, 04:12 AM
Authorized User
 
Join Date: Jul 2010
Posts: 27
Thanks: 6
Thanked 0 Times in 0 Posts
Default you are right. It works. Thanks,

Quote:
Originally Posted by mrame View Post
Try with the below:
Code:
<xsl:variable name="s" select="number(substring-before(substring-after(@transform,'scale('),')'))"/>
I just added a '(' to 'scale'.
Yes. I forget the ( character





Similar Threads
Thread Thread Starter Forum Replies Last Post
convert time field to number jobalistic Access 17 February 22nd, 2013 12:40 PM
Cannot convert number to NodeSet anarleti XSLT 5 May 4th, 2010 08:52 AM
Convert date to number samirz10 Access 1 July 22nd, 2005 03:04 PM
how to replace a string with another string/number crmpicco Javascript How-To 4 March 14th, 2005 12:59 PM
Convert to a number ticktack Classic ASP Basics 4 February 9th, 2004 05:31 AM





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