Subject: Re: [xsl] Implementing JavaScript From: "Vasu Chakkera" <vasucv@xxxxxxxxxxx> Date: Thu, 31 Oct 2002 09:33:14 -0000 |
Hi Johnny, since you have commented out the javascript code,it will not appear in the output HTML.So your javascript doesnt work.move your javascript code into CDATA Section <![CDATA[ mon=new Array ("JAN","FEB","MAR","APR","MAY","JUN","JUL","AUG","SEPT","OKT","NOV","DEZ") heute= new Date() var datstring =(heute.getDate()<10)?"0"+heute.getDate():heute.getDate ().toString()+"-"+mon[heute.getMonth()]+"-"+heute.getFullYear() document.write("<option>" + datstring + "</option>") ]]> This should work. HTH ----- Original Message ----- From: <Johannes.Becker@xxxxxx> To: <XSL-List@xxxxxxxxxxxxxxxxxxxxxx> Sent: Thursday, October 31, 2002 7:42 AM Subject: [xsl] Implementing JavaScript > Hi, > > I'm having problems implementing JavaScript in my XSL files. Here the code. > > XSL-File hello.xsl: > > <?xml version="1.0" encoding="UTF-8"?> > <xsl:stylesheet version="1.0" xmlns:xsl=" > http://www.w3.org/1999/XSL/Transform" xmlns:fo=" > http://www.w3.org/1999/XSL/Format"> > > <xsl:template match="/hallo"> > > <html> > > <head> > <title> > <xsl:value-of select="@title"></xsl:value-of></title> > </head> > > <body> > > <select name="D1" size="1"> > <script language="JavaCcript"> > <!-- > mon=new Array > ("JAN","FEB","MAR","APR","MAY","JUN","JUL","AUG","SEPT","OKT","NOV","DEZ") > heute= new Date() > datstring =(heute.getDate()<10)?"0"+heute.getDate():heute.getDate > ().toString()+"-"+mon[heute.getMonth()]+"-"+heute.getFullYear() > document.write("<option>" + datstring + "</option>") > //--> > </script> > </select> > </body> > </html> > > > </xsl:template> > > > </xsl:stylesheet> > > > XML-File hello.xml: > > <?xml version="1.0" encoding="UTF-8"?> > <?xml-stylesheet href="hello1.xsl" type="text/xsl"?> > <hallo title="Hallo"> > </hallo> > > > This should put the current date in a select box. Works fine in html, but > not in xml. > > What is wrong with my code? Does anyone know a tutorial or whatsoever on > the topic: Javascript in xsl/xml. Haven't really found anything on the net. > > > Thanks > Jonny > > > XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list > XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] Implementing JavaScript, Johannes . Becker | Thread | Re: [xsl] Implementing JavaScript, Jeni Tennison |
Re: [xsl] New to the list, Jeni Tennison | Date | Re: [xsl] Implementing JavaScript, Jeni Tennison |
Month |