Go Back   CodingForums.com > :: Client side development > XML

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 12-18-2002, 05:57 AM   PM User | #1
Skyzyx
Regular Coder

 
Skyzyx's Avatar
 
Join Date: Aug 2002
Location: Silicon Valley, CA
Posts: 980
Thanks: 0
Thanked 0 Times in 0 Posts
Skyzyx is on a distinguished road
Problem using document.write() with XSL under Gecko

Maybe it's just me, but has anyone else had a problem with using document.write() in a JavaScript that is inside an XSL file under Gecko?

It seems to work well for IE6, but Mozilla keeps crashing. Has anyone got any ideas? JKD, you seem to be the Gecko God... do you know?
__________________

Creator of SimplePie and Tarzan AWS, co-founder of WarpShare, co-built the Y! Messenger website, usability-focused, and an INFJ personality.
Skyzyx is offline   Reply With Quote
Old 12-18-2002, 11:51 AM   PM User | #2
jkd
Senior Coder

 
jkd's Avatar
 
Join Date: May 2002
Location: metro DC
Posts: 3,163
Thanks: 1
Thanked 18 Times in 18 Posts
jkd will become famous soon enough
document.write() is an HTML-DOM method.

The result of an XSL transformation is XML, such as XHTML. Therefore, the document.write() method shouldn't be present.
__________________
jasonkarldavis.com
jkd is offline   Reply With Quote
Old 12-18-2002, 10:31 PM   PM User | #3
Alex Vincent
Moderator


 
Join Date: May 2002
Location: Hayward, CA
Posts: 1,427
Thanks: 1
Thanked 19 Times in 17 Posts
Alex Vincent is on a distinguished road
Crashing? You should probably file a bug for that at http://bugzilla.mozilla.org under XSLT, with keyword "crash", and also any Talkback ID you get from Mozilla Talkback (\bin\components\talkback.exe).
__________________
"The first step to confirming there is a bug in someone else's work is confirming there are no bugs in your own."
June 30, 2001
author, Verbosio prototype XML Editor
author, JavaScript Developer's Dictionary
https://alexvincent.us/blog
Alex Vincent is offline   Reply With Quote
Old 12-19-2002, 06:05 AM   PM User | #4
Skyzyx
Regular Coder

 
Skyzyx's Avatar
 
Join Date: Aug 2002
Location: Silicon Valley, CA
Posts: 980
Thanks: 0
Thanked 0 Times in 0 Posts
Skyzyx is on a distinguished road
I have sent it in to BugZilla. I was contacted and told that it would be fixed by the next release, which was supposed to be 1.2. I'm still having problems though.

JKD, thanks. I was unaware of that. The reason I ask is that I use QuickBooks at work. QuickBooks can export to Excel, which can save as XML. I've been using JavaScript to parse time and date data from the generated XML file, but I was hoping to use XSL instead, because CSS seems to work better on an XSLT page that with data imported into an HTML page for some reason.

Other JavaScript seems to work fine, including sending information to a SPAN tag using innerHTML... just no document.write();

Thanks anyways...
__________________

Creator of SimplePie and Tarzan AWS, co-founder of WarpShare, co-built the Y! Messenger website, usability-focused, and an INFJ personality.
Skyzyx is offline   Reply With Quote
Old 09-09-2010, 02:19 PM   PM User | #5
Leksiq
New to the CF scene

 
Join Date: Sep 2010
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Leksiq is an unknown quantity at this point
If you should use inside an XSL file a script with document.write() and you cannot edit it(some counter for example), the next trick can help:

Code:
<script type="text/javascript">
// this is your script somewhere in HEAD
                        var document_write = '';
                        var obj = null;
                        document.write = function(str) {
                            document_write += str;
                        }
                        function begin(id) {
                            obj = document.getElementById(id);
                        }
                        function end() {
                            if(obj) {
                                obj.innerHTML = document_write;
                            }
                            document_write = '';
                        }

</script>

<!-- somewhere in BODY where you plan use another's script -->
<div id="some_id">
     <script type="text/javascript">begin('some_id');</script>
     <script type="text/javascript" src="http://www.other-domain.com/some_script_with_document_write.js"></script>
     <script type="text/javascript">end();</script>

</div>

Last edited by Leksiq; 09-09-2010 at 02:24 PM..
Leksiq is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 07:22 PM.


Advertisement
Log in to turn off these ads.