[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
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
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|