This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
RE: javascript and xsl
- To: "'xsl-list at lists dot mulberrytech dot com'" <xsl-list at lists dot mulberrytech dot com>
- Subject: RE: [xsl] javascript and xsl
- From: Theodore Weatherly <tweather at slamdunknetworks dot com>
- Date: Tue, 8 May 2001 10:19:57 -0700
- Reply-To: xsl-list at lists dot mulberrytech dot com
Tanzila,
Try placing your Javascript in an xsl:comment block:
<SCRIPT language="JavaScript">
<xsl:comment><![CDATA[
function MM_findObj(n, d) { //v3.0
...
[your javascript here]
//]]></xsl:comment>
</SCRIPT>
-Ted
-----Original Message-----
From: Tanzila Mohammad [mailto:tmohammad@entier-solutions.com]
Sent: Tuesday, May 08, 2001 8:14 AM
To: xsl-list@lists.mulberrytech.com
Subject: RE: [xsl] javascript and xsl
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&&parent.frames.length) {
d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
if(!(x=d[n])&&d.all) x=d.all[n]; for
(i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
for(i=0;!x&&d.layers&&i<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<(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<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<min || max<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
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list