xsl-list
[Top] [All Lists]

all-XSLT implementation of Minesweeper

2005-03-14 19:27:45


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


--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--