[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: XSL and HTML interaction
Robert G wrote:
Is there any other way to add to the original html file without using xsl to create new html and then including that in the original html? I was looking stuff up online and some sites suggest you can just "copy and paste" nodes to the original html? Thanks. It depends on the APIs the browser or its XSLT engine exposes. Mozilla for instance gives you transformToFragment (https://developer.mozilla.org/en/The_XSLT%2f%2fJavaScript_Interface_in_Gecko/JavaScript%2f%2fXSLT_Bindings) and that way you can have the XSLT stylesheet create DOM nodes owned by the target document (e.g. HTML document) which you can then insert using W3C DOM methods like appendChild or insertBefore. I think Opera and Safari expose the same API by now. IE uses MSXML for XML and XSLT and that way has two completely separate DOM implementations, the XML DOM of MSXML and the HTML DOM of IE/MSHTML. You can't copy/move/import/adopt nodes between these two DOM implementations so what you do there is have a string result of the transformation (e.g. from transformNode()) and then parse that by setting innerHTML or using insertAdjacentHTML in the HTML DOM. -- Martin Honnen http://msmvps.com/blogs/martin_honnen/
|
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
|