p2p.wrox.com Forums

Need to download code?

View our list of code downloads.


Go Back   p2p.wrox.com Forums > XML > XSLT
I forgot my password Register Now
Register | FAQ | Members List | Calendar | 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 p2p Programmer to Programmer discussion community. This is a community of more than 40,000 computer programmers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining our free Wrox p2p community you can post your own programming questions and respond to other programmers’ questions. Registered users also don't have to see the ads that are displayed to guests. Registration is fast, simple and absolutely free so please, join today!
Join today and post to win prizes! Post more to increase your chances of being Wrox’s top poster of the month.

Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old January 6th, 2009, 09:50 AM
Authorized User
Points: 304, Level: 6
Points: 304, Level: 6 Points: 304, Level: 6 Points: 304, Level: 6
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jan 2007
Location: durban, Africa, South Africa.
Posts: 71
Thanks: 0
Thanked 0 Times in 0 Posts
Question Valid Javascript to get working in xslt

Hi,
I found this code that allows anly numeric char, the problem i have is that the xslt file does not like the script:

<SCRIPT TYPE='text/javascript'>
function IsNumeric(sText)
{
var ValidChars = "0123456789.";
var IsNumber=true;
var Char;

for (i = 0; i < sText.length && IsNumber == true; i++)
{
Char = sText.charAt(i);
if (ValidChars.indexOf(Char) == -1)
{
IsNumber = false;
}
}
return IsNumber;

}
</SCRIPT>

Please Assist!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
  #2 (permalink)  
Old January 6th, 2009, 10:26 AM
mhkay's Avatar
Wrox Author
Points: 11,934, Level: 47
Points: 11,934, Level: 47 Points: 11,934, Level: 47 Points: 11,934, Level: 47
Activity: 81%
Activity: 81% Activity: 81% Activity: 81%
 
Join Date: Apr 2004
Location: Reading, Berks, United Kingdom.
Posts: 3,776
Thanks: 0
Thanked 52 Times in 50 Posts
Default

What is the relationship of this script to your XSLT (did it embed it, invoke it, generate it?)

And what makes you think it didn't like it? Was there an error message?

Note that any text containing "<" or "&" must be properly escaped if included in an XML file.
__________________
Michael Kay
http://www.saxonica.com/
Author, XSLT 2.0 and XPath 2.0 Programmer\'s Reference
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
  #3 (permalink)  
Old January 7th, 2009, 04:05 AM
Authorized User
Points: 304, Level: 6
Points: 304, Level: 6 Points: 304, Level: 6 Points: 304, Level: 6
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jan 2007
Location: durban, Africa, South Africa.
Posts: 71
Thanks: 0
Thanked 0 Times in 0 Posts
Question

Hi, Thank You.

I have dev tool that uses asp + xslt page.
On the dev tool I have objects, text box with poperties & events i can use.
The problem i have is that I only want a numeric value in a textbox of datatype text. Don't want to change it to numeric as it rounds/trims the value when wanting to do a calulcation.
So in the xslt file i want to add a javascript function that i can use on the onkeyevent of the textbox not to allow numeric characters.
Still struggling though!
The function between the <![CDATA[ is like it is filtered out (font light grey) and can't use the function.
<SCRIPT TYPE='text/javascript'>
<![CDATA[
function IsNumeric(sText)
{
var ValidChars = "0123456789.";
var IsNumber=true;
var Char;
for (i = 0; i < sText.length && IsNumber == true; i++)
{
Char = sText.charAt(i);
if (ValidChars.indexOf(Char) == -1)
{
IsNumber = false;
}
}
return IsNumber;
}
]]>
</SCRIPT>
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
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

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
class names in xslt not working chobo XSLT 2 January 13th, 2008 01:43 AM
Working JavaScript Regex vinaura Javascript How-To 0 August 16th, 2007 01:06 PM
Javascript Not working sohrabus ASP.NET 2.0 Professional 4 May 5th, 2007 12:42 PM
diff b/w javascript validation & server side valid ashu VS.NET 2002/2003 1 March 27th, 2007 09:30 AM
working with existing xml using xslt bv_arvind XSLT 1 March 12th, 2007 01:37 PM



All times are GMT -4. The time now is 09:45 PM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
© 2008 Wiley Publishing, Inc