Click to See Complete Forum and Search --> : String handling of XSL-transformed XML in Firefox


Engywook
06-23-2008, 05:43 PM
I'm using XSL to transform an XML file; however, there is some additional string handling I would want to do between the time the transformation is done and display on page.

Code for non-IE browsers, adopted from w3schools, is here:


xsltProcessor=new XSLTProcessor();
xsltProcessor.importStylesheet(xsl);

/*transFormToFragment returns an object, not a string
The object returned has no methods or properties.
How can anything be done with this text aside from appending it? */
resultDocument = xsltProcessor.transformToFragment(xml,document);

/*This is my workaround - append the object to a hidden div....*/
whereHide=where+"Hidden";
document.getElementById(whereHide).appendChild(resultDocument);

/*Then use javascript on the contents of the hidden div...*/
textCrunch=document.getElementById(whereHide).innerHTML;
textCrunch=scrubTags(textCrunch);

/*....finally, send it to where I really want it to go*/
document.getElementById(where).innerHTML=textCrunch;


None too elegant, I'll be first to admit. Is there a way to get the text out of the object created by the transformToFragment method? Or is there another way to do a transformation that will work without ActiveX?

rpgfan3233
06-24-2008, 09:08 AM
Well, resultDocument should have HTML DOM properties. Is there any reason why innerHTML doesn't suffice when used on resultDocument?