Re: XSLT Conversion not quite there

Martin Honnen <[email protected]>
Newsgroups gmane.comp.mozilla.devel.layout.xslt
Organization Liberty Development
Message-ID <[email protected]>

[email protected] wrote:

> Thanks tried that, and although I get no errors javascript wise I get
> no results either. If I inspect the DOM there is nothing there.

Then the problem is likely not with the transformation and with 
inserting the transformation result somewhere but earlier with loading 
the XML and/or the XSLT document.
Your code

> function handleHttpResponse() {
>   if (http.readyState == 4) {
>     if (http.responseText.indexOf('invalid') == -1) {
>       // Use the XML DOM to unpack the city and state data
>       	xmlDocument = http.responseXML;
>         var xmldoc = document.implementation.createDocument("", "",
> null);
>         var xsldoc = document.implementation.createDocument("", "",
> null);
>             // These browsers process the code before files are loaded,
>             // thus need to call DoLoaded function when the files
> finishloading
>         xmldoc.load("books.xml");
>         xsldoc.load("books.xsl");
> 		var xsltProcessor = new XSLTProcessor();
>         xsltProcessor.importStylesheet(xsldoc);

looks indeed odd, it is not clear why
   xmlDocument = http.responseXML
is assigned but not used.
And then later where you call
   xmldoc.load("books.xml");
   xsldoc.load("books.xsl");
you seem to ignore that loading happens asynchronously and that you 
would need an onload handler.


-- 

	Martin Honnen
	http://JavaScript.FAQTs.com/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.