RE: [xsl] The case of the mysteriously corrupted XSL transformation (ARRGH)

Subject: RE: [xsl] The case of the mysteriously corrupted XSL transformation (ARRGH)
From: "Wong Chin Shin" <publicbbs@xxxxxxxxxxxxxxxx>
Date: Thu, 2 Dec 2004 10:05:58 +0800
Hi Anton,

Thanks for the help.

I see what you mean, but can I clarify:

Is it true that "on-the-fly" Javascript like document.write will have
problems working in an XSL-transformed page? I had the impression that the
transformation layer is just an additional layer and that the browser would
consider the final code only. If this is the case, a lot of existing scripts
would be off-limits to whoever's trying to employ this technique.

Also, the fact that it works using some XSL parsers and not with others is a
worry. I just hope that I'm doing things according to specs so far and the
next server upgrade won't break it.

Thanks!
Wong

-----Original Message-----
From: Anton Triest [mailto:anton@xxxxxxxx] 
Sent: Wednesday, December 01, 2004 10:58 PM
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: Re: [xsl] The case of the mysteriously corrupted XSL transformation
(ARRGH)

Hello Wong Chin Shin,

I think the problem is in javascript, not in the XSL. When I open 
AddPage.xml in Firefox, I get a blank page just like you say, and the 
JavaScript Console reports several js errors:

Error: uncaught exception: [Exception... "Component returned failure 
code: 0x80004003 (NS_ERROR_INVALID_POINTER) 
[nsIDOMNSHTMLDocument.write]"  nsresult: "0x80004003 
(NS_ERROR_INVALID_POINTER)"  location: "JS frame :: 
http://www.nascencetech.com/recruitexpressmy/fckeditor/fckeditor.js :: 
anonymous :: line 53"  data: no]

(JavaScript Console is in the Firefox Tools menu)

When I make a local copy of your xml and xsl (without the javascript 
files) I do get the form displayed in FF:
it still reports a few javascript errors but not the uncaught exception.

This fckeditor is some kind of "on-the-fly HTML editor", right?
Line 53 of fckeditor.js:

    document.write( '<div>' ) ;

A wild guess: this javascript code is trying to write something to the 
output document;
that will work fine on a "real" document but apparently not on the 
result of an XSL transform...

That would also explain why the static file (XSLOutput.html) displays 
correctly.

HTH,
Anton




Wong Chin Shin wrote:

>Hi,
>
>Behind that miserable attempt at email subject humor, there a whole lotta
>suffering going on. In between my efforts to debug my XSL transformation,
>validate my transformed HTML and ensure cross-browser compatibility, I
>managed to screw up my entire transformation on Firefox.
>
>The XML file is at
>http://www.nascencetech.com/recruitexpressmy/webadmin/AddPage.xml
>The XSL file is at
>http://www.nascencetech.com/recruitexpressmy/xsl/webadmin.xsl
>
>Nothing appears when I load AddPage.xml on Firefox. Zilch, nada. Works a
>treat on IE though. 
>
>So I used XMLSpy to do a manual transform and tried to view the output as a
>static HTML file. Firefox displays the static html perfectly. I also
>validated the resultant code as valid HTML 4.01. The static file can be
>found at:
>http://www.nascencetech.com/recruitexpressmy/webadmin/XSLOutput.html
>
>So, I guess somehow, something's wrong with my XSL or XML file such that FF
>rejects it? How, I'm not sure...
>
>My clues:
>I had been screwing with a few XML/XSL editors the past couple of days.
>Tried XMLSpy, Treebeard, JEdit amongst others. Yesterday, I had errors
>transforming the XML using Treebeard and JEdit, saying that there was
>content in the prolog. I read that this error shows that there's a
character
>before the XML declaration tag. Also read that using certain editors would
>insert some "BOM" character as the first char of an XML file. Not sure if
>this was the problem but at that time both FF and IE still managed to do
the
>transformation.
>
>Well, that's where my debugging efforts landed me so far. If there's
anybody
>who can verify if I somehow corrupted my XML/XSL file, I would be much
>obliged. The guys here have been terrific in giving advice, I learned much
>over the past 3 weeks (a bit of shoe-polishing never hurt, heh). 
>
>Oh, please do not try to submit the form, I haven't gotten that far yet :P
>
>Thanks
>Wong

Current Thread