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

Re: how to call Javascript function in .xsl file

Subject: Re: how to call Javascript function in .xsl file
From: Paul Prescod <papresco@xxxxxxxxxxxxxxxx>
Date: Sun, 08 Nov 1998 11:30:47 -0600
call javascript function from xml
Amit Rekhi wrote:
> 
> Why should adding HTML JavaScript code to template be a problem.
> Can't I have a pattern rule like :-
> 
> <xsl:template match="/">
> <HTML>
>    <HEAD>
>      <SCRIPT LANGUAGE="JavaScript"><![CDATA[
>         function Test()
>         {
> ....
> 
> Is not this a valid template ?

It is valid, but the XML processor will probably not understand the
behaviour of the SCRIPT element. Thus it will presume that less-than
symbols should be entity-ized on output. But HTML browsers do not expect
this. The fundamental problem is that HTML is *NOT* XML compatible but the
output of an XSL processor is XML. A smart enough XML processor can embed
special knowledge about HTML and HTMLize the output, but they are not
required to.

XSL is for XML->XML transformations, not XML->HTML transformations. 

<grumble>The SCRIPT element was always broken. It was alternately defined
in ways that were incompatible with SGML and then used SGML features that
were widely deprecated. Now they've been officially deprecated (in XML)
and we're stuck with incompatibility.</grumble>

See:
http://www.w3.org/TR/REC-html40/appendix/notes.html#notes-specifying-data

 Paul Prescod  - http://itrc.uwaterloo.ca/~papresco

"The new revolutionaries believe the time has come for an aggressive 
move against our oppressors. We have established a solid beachhead 
on Friday. We now intend to fight vigorously for 'casual Thursdays.'
  -- who says America's revolutionary spirit is dead?


 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.