Web development

xml:space="preserve" and xsl:attribute

Wednesday, September 27th, 2006 by DenisH

Just a quick tip about xsl which I haven’t found anywhere else…

I wanted to generate some human (well me) readable XML using XSL and found that if you add xml:space=”preserve” to the opening tag, then, at least if you are using Xalan and Java to do the transformation, it will preserve the spaces between the tags in the XSL and you’ll get something more or less readable. (more…)

Debugging Javascript in Firefox

Monday, March 27th, 2006 by DenisH

I’ve recently been trying to make some of my scripts work with Firefox 1.5 (from IE) and I was looking for some debugging help to set me on the right track. I found this tool which seems to work very well: http://getahead.ltd.uk/ajax/venkman.

It’s an updated version of Venkman fixed to work with Firefox 1.5.

One of the things it helped me find is that whereas in IE if I ask a table cell (TD) for the nextSibling and get the next TD, in Firefox you always seem to get a text node first and then the next TD. Similarly for getting the next and previous rows.

Javascript Debug Utility

Friday, October 7th, 2005 by DenisH

Note: See the May 2008 update at the bottom of this article.

One of the problems when writing JavaScript is that you don’t have a development environment with a debugger to find out what’s going on. For Microsoft platforms, there is the Microsoft Script Debugger which provides some help, but often people resort to just sprinkling alert("You are here") around the code to find out what’s going on. The problems with this approach are that you can’t easily switch them on and off without going through and commenting out individual calls; the fact that you get a dialog box up which needs to be accepted by the user can affect time-sensitive code, so you might not be able to debug it using this method; and finally it’s difficult to compare values from one alert to the next since the text just comes up in a dialog box.

Here we present three functions that allow you to put debug calls in your code and switch them on and off as needed. (more…)