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

Re: all-XSLT implementation of Minesweeper

Subject: Re: all-XSLT implementation of Minesweeper
From: "Joe Fawcett" <joefawcett@xxxxxxxxxxx>
Date: Tue, 15 Mar 2005 08:38:07 -0000
table layout fixed firefox
----- Original Message ----- From: "Sean Whalen" <seanwhalen@xxxxxxxxxxx>
To: <xsl-list@xxxxxxxxxxxxxxxxxxxxxx>
Sent: Tuesday, March 15, 2005 2:27 AM
Subject: all-XSLT implementation of Minesweeper





http://seanwhalen.home.comcast.net/sweeperscript/

I started this as a personal educational project to see how much of the data management and rules I could encode in XSLT. The main page uses javascript to handle the mouse-events and to generate the random numbers. Everything else is done in 3 different xslt files. The first stylesheet takes a set of random numbers and a pair of min/max values and returns a list of elements representing a full grid. The next style sheet transforms the list of nodes into grid of HTML buttons. The third sheet returns the set of squares that are revealed when the user clicks on a square. This is a recursive algorithm that looks for flags in squares bordering the square that was clicked. That set is then sent to the same algorithm, and the template finds the flags bordering those squares, etc, until no more bordering flags are found.
I'll probably dress up the page a little this week with some explanatory text.


I'd posted here a week or so ago regarding the speed difference between MS-IE and FireFox. I posted a bug report to Mozilla about it which generated a lot of chatter among their developers regarding what performance improvements would be effective.

I had a real problem with MS-IE in how it reacted to"deferred" <SCRIPT> blocks inside the xslt. The problem seemed to do with when it chose to execute the script generated from the stylesheet. Firefox was much more predictable how it handled the <SCRIPT>. For the thing to work in IE, I took all the script out of the stylesheet, which in this case seemed like the better approach anyway.

regards,

Sean



Very impressive, you may get a quicker rendering of the table if you set its style to table-layout-fixed. As it's a regular table the browser then doesn't "worry" about whether parts towards the bottom will alter the layout of cells rendered near the top.
And one question about some of the code. Why do you alternate between using msxml2.domdocument.3.0 and microsoft.xmldom?


Joe

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.