As sad, desperate and/or pathetic as it may sound, I often times will find myself rooting around the Mono Project SVN repository looking for buried treasure; One of the intended side effects of open source software is the freedom and encouragement to experiment, so there’s a tendency for those willing to dig to find things that haven’t made it into an official release, but they’re both useful and useable tools, libraries, applications, etc. none-the-less.

Today, apparently, is my lucky day (though I’m surprised I hadn’t noticed this before given Eno did the initial check in 7 months ago),


 Assembly/	 81031	 7 months	 atsushi	 initial checkin.
  Mono.Xml/	 81031	 7 months	 atsushi	 initial checkin.
  Mono.XsltDebugger/	 81155	 6 months	 atsushi	 2007-07-02 Atsushi Enomoto <atsushi@ximian.com> * XsltDebugger.cs XsltDebugg...
  ChangeLog	 81031	 7 months	 atsushi	 initial checkin.
  Makefile	 81031	 7 months	 atsushi	 initial checkin.
  Mono.XsltDebugger.dll.sources	 81031	 7 months	 atsushi	 initial checkin.

To get the debugger to work you’ll need to check-out two folders,

http://anonsvn.mono-project.com/source/trunk/olive/class/Mono.XsltDebugger/

… and …


http://anonsvn.mono-project.com/source/trunk/olive/tools/xslt-debugger/

… run make; sudo make install in both at which point you will have Mono.XsltDebugger and xslt-debugger.exe in <mono-prefix-root>/lib/mono/{3.0|3.5} (it wound up in the ~/3.0 folder on Linux and ~/3.5 on OS X. Not sure why, though I’m sure the reason is easy enough to track down.) By then running,


mdavid$ mono /usr/local/lib/mono/3.0/xslt-debugger.exe page/controller/atomictalk/base.xsl index.page

… results in,


[xslt]

… which, as it turns out, is a rudimentary interactive XSLT debugging console,


[xslt] help
help
Show this help.
quit (q)
exit
Quits the debugger.
run
Runs a transform.
continue (cont)
Continues an interrupted transform.
break <xpath>
Sets a breakpoint for output to hit XPath match.
break <line> <column> [uri]
Sets a breakpoint to match specified stylesheet element
at (<line>, <column>) ([uri] is the primary stylesheet by default).
break list
Lists the registered breakpoints.
break remove <index>
Removes specified breakpoints.
break clear
Removes all of the registered breakpoints.
xmlns add [prefix] <uri>
Adds a namespace mapping from [prefix] ('' by default) to <uri> used
to resolve prefixes in XPath.
xmlns remove [prefix]
Removes a namespace mapping by [prefix] ('' by default) used to
resolve prefixes in XPath.
xmlns list
Lists a namespace mapping used to resolve prefixes in XPath.
output [lines]
Shows the transformation result within [lines] (default = 10).
batch 
Processes batch commands listed in <filename>.
load stylesheet <filename>
Loads a stylesheet <filename>.
load input <filename>
Loads an input document <filename>.
clear [number]
 Removes the specified breakpoint by breakpoint index.
list breakpoints (bp)
 Shows the list of breakpoints.

While it seems the functionality at the moment is limited, there are some basic operations that will run successfully. For example,


[xslt] break /html/head
[xslt] run
Breakpoint matched
[xslt] output
<head />
[xslt] cont
[xslt] Transform finished
[xslt] output
<html>
  <head>
    <style type="text/css" />
  </head>
</html>
[xslt]

As I did above, you can specify the transformation xml and data xml when launching the application which then pre-loads both into memory. According to the help output you can apparently load them into memory from within the console via,


load stylesheet <filename>

… and …


load input <filename>

… but apparently the resolver code needs some attention,


[xslt] load stylesheet page/controller/atomictalk/base.xsl
File stylesheet does not exist

Just to be sure,


[xslt] load stylesheet /Users/mdavid/Projects/Nuxleus/Public/Web/Development/page/controller/atomictalk/base.xsl
File stylesheet does not exist

… and …


[xslt] load stylesheet file:///Users/mdavid/Projects/Nuxleus/Public/Web/Development/page/controller/atomictalk/base.xsl
File stylesheet does not exist

In poking around a bit more, it’s obvious there’s still work to be done, but the fact that the project even exists is pretty cool, and given the open source nature of — well, open source ;-) — it certainly opens up the door for anyone who might feel so inclined to jump in and start hacking away at things.

Maybe that person will be you? Don’t know, but I for one would think you were one of the coolest people who’s ever walked the planet if you did.

Okay, so maybe that would be a deterrent rather than encouragement, but regardless, the offers on the table. ;-) :D

Oh, and special thanks to Eno (Atsushi Enomoto) for what looks to be the original author of the code base! (there’s no notes attached to the source so I’m going directly from SVN log entries.)