[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: javascript and xsl

Subject: RE: javascript and xsl
From: "Tanzila Mohammad" <tmohammad@xxxxxxxxxxxxxxxxxxxx>
Date: Tue, 8 May 2001 16:14:15 +0100
mm_findobj javascript
I have some javascript contained within my xsl sheet:

<xsl:template match="/">
<!--start html page-->
<html>
<head>
<title>Edit an Event</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"/>
<script language="JavaScript">

function MM_findObj(n, d) { //v3.0
  var p,i,x;  if(!d) d=document;
if((p=n.indexOf("?"))>0&amp;&amp;parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&amp;&amp;d.all) x=d.all[n]; for
(i=0;!x&amp;&amp;i&lt;d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&amp;&amp;d.layers&amp;&amp;i&lt;d.layers.length;i++)
x=MM_findObj(n,d.layers[i].document); return x;
}

function MM_validateForm() { //v3.0
  var i,p,q,nm,test,num,min,max,errors='',args=MM_validateForm.arguments;
  for (i=0; i&lt;(args.length-2); i+=3) { test=args[i+2];
val=MM_findObj(args[i]);
    if (val) { nm=val.name; if ((val=val.value)!="") {
      if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@');
        if (p&lt;1 || p==(val.length-1)) errors+='- '+nm+' must contain an
e-mail address.\n';
      } else if (test!='R') { num = parseFloat(val);
        if (val!=''+num) errors+='- '+nm+' must contain a number.\n';
        if (test.indexOf('inRange') != -1) { p=test.indexOf(':');
          min=test.substring(8,p); max=test.substring(p+1);
          if (num&lt;min || max&lt;num) errors+='- '+nm+' must contain a
number between '+min+' and '+max+'.\n';
    } } } else if (test.charAt(0) == 'R') errors += '- '+nm+' is
required.\n'; }
  } if (errors) alert('The following error(s) occurred:\n'+errors);
  document.MM_returnValue = (errors == '');
}

</script>
</head>

<body bgcolor="#FFFFFF">
<form name="form1" method="post" action=""
onSubmit="MM_validateForm('0','','R','0','','R','0','','R','1','','R','1',''
,'R','2','','R','1','','R','city','','R','country','','R','region','','R','o
rganisation','','R');return document.MM_returnValue">
  <table width="600" cellpadding="5" cellspacing="5" border="0">
    <tr bgcolor="#FFFFFF">
      <td colspan="2" valign="top">
        <p align="left"><font face="Arial, Helvetica, sans-serif"
color="#FF6600" size="4"><b>Edit
          An Event </b></font></p>
      </td>
    </tr>

etc ......

</template>

PROBLEM:
I am using saxon and I am getting the following error:
java.lang.NullPointerException

Am I missing something?
- I have altered all & and < characters to comply with xslt notation.
- do I need to include some statement in the xsl sheet?

Tanz


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.