|
|
 |
| 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.
|
 |

January 6th, 2009, 09:50 AM
|
|
Authorized User
|
|
Join Date: Jan 2007
Location: durban, Africa, South Africa.
Posts: 71
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
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!
|

January 6th, 2009, 10:26 AM
|
 |
Wrox Author
Points: 11,934, Level: 47 |
|
|
Join Date: Apr 2004
Location: Reading, Berks, United Kingdom.
Posts: 3,776
Thanks: 0
Thanked 52 Times in 50 Posts
|
|
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
|

January 7th, 2009, 04:05 AM
|
|
Authorized User
|
|
Join Date: Jan 2007
Location: durban, Africa, South Africa.
Posts: 71
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
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>
|
| Thread Tools |
Search this Thread |
|
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
 |