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

Re: XSL and HTML interaction

Subject: Re: XSL and HTML interaction
From: Martin Honnen <Martin.Honnen@xxxxxx>
Date: Fri, 22 May 2009 18:02:44 +0200
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/

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.