This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Javascript in XSL


[Annelies Vercruysse]

>
> I'm converting existing HTML pages to XML-XSL combinations. My current
HTML
> pages contain Javascripts that treat elements in the HTML document.
> (getElementById();)
>
> It seems that these javascripts are completely ignored when opening the
XML
> page. Could it be that an XML page doesn't have the "document"-property so
> an element will never be found?
>
> I've already tried to put the javascript between the following tags:
> <![CDATA[    ....     ]]>
>
> (I use the Netscape 6.1 browser)
>
> are there any known bugs with Javascripts within XSL?
> can anyone please help me? It would very much be appreciated!
>

Javascript scripts are run when they appear in an html page.  If you put
them, using the same syntax, into an xml page, the html processor is not
invoked and there is nothing inherent in xml to cause them to run.  Hence
your results.

However, if you use xslt to produce legal html or xhtml pages, then the html
processor will run the javascript - as long as the browser knows that the
pages are html.  This is usually achieved by naming the file with a name
ending in ".htm" or ".html", although sometimes setting the right MIME
header works (that is something that gets set outside of the html document).

Cheers,

Tom P


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]