xsldbg
is a text based tool to debug stylesheets and it is similar to the Unix/Linux debugger gdb. It uses using the libxslt library by http://www.xmlsoft.org/XSLT
is in a stable stage of development with functionality now frozen until the start of the next beta cycle. Comments about feature set provided are welcome.
has GUI front end for Qt5 called qxsldbg
has GUI front end for KDE, called kxsldbg that supports a Kate plugin using xsldbg
breakpoints can be set on XSLT script or XML data file
setting breakpoint on import/included XSLT scripts is now supported
See https://sourceforge.net/projects/xsldbg/files/xsldbg/
The lastest release downloads
Note:Prebuilt Win32 binaries are provided for xsldbg and qxsldbg products.
The primary author is Keith Isdale
The author for the riscos specific code is Justin Fletcher
The author some of the WIN32 code is Igor Zlatkovic
This tool is available under the GPL licence
Running xsldbg-mode under XEmacs in Linux and WIN32
Running the qxsldbg under KDE, it will look similar under MinGW32 or cygwin.
http://xsldbg.sourceforge.net/
http://sourceforge.net/projects/xsldbg
http://xsldbg.sourceforge.net/docs/xsldbg/manual/ ,the xsldbg manual
http://xsldbg.sourceforge.net/docs/qxsldbg/manual/ ,the qxsldbg manual
http://lists.sourceforge.net/lists/listinfo/xsldbg-announce
For installation instructions see the README.md in the downloaded source package.
To test / try out xsldbg
cd xsldbg/docs/en
xsldbg --shell xsldoc.xsl xsldoc.xml
And you should get the xsldbg prompt like
XSLDBG <VERSION>
Starting stylesheet
Breakpoint at file xsldoc.xsl : line 18
xsldbg) xsl:param >
You can now start entering commands at the "(xsldbg) .* >" prompt. In the example text in
green has been typed by the user.
To print help just type "help";
To exit xsldbg just type "exit"
Breakpoint at file xsldoc.xsl : line 18
(xsldbg) xsl:param > templates
template :"/" in file xsldoc.xsl : line 23
template :"helpOnCommand" in file xsldoc.xsl : line 49
template :"header" in file xsldoc.xsl : line 67
template :"text()" in file xsldoc.xsl : line 79
template :"para" in file xsldoc.xsl : line 83
template :"list | usage" in file xsldoc.xsl : line 89
template :"comment" in file xsldoc.xsl : line 99
template :"cmd-summary" in file xsldoc.xsl : line 103
template :"cmd" in file xsldoc.xsl : line 109
Total of 9 templates found
Total of 9 templates printed
(xsldbg) xsl:param > break /
Size of line list was 0 adding 24 entries
(xsldbg) xsl:param > break header
Size of line list was 24 adding 44 entries
(xsldbg) xsl:param > showbreak
Breakpoint 1 enabled for template :"/" in file xsldoc.xsl : line 23
Breakpoint 2 enabled for template :"header" in file xsldoc.xsl : line 67
Total of 2 breakPoints present
(xsldbg) xsl:param > break -l xsldoc.xsl 44
(xsldbg) xsl:param > showbreak
Breakpoint 1 enabled for template :"/" in file xsldoc.xsl : line 23
Breakpoint 3 enabled in file xsldoc.xsl : line 44
Breakpoint 2 enabled for template :"header" in file xsldoc.xsl : line 67
Total of 3 breakPoints present
(xsldbg) xsl:param > continue
Reached template :"/"
Breakpoint 1 Breakpoint in file xsldoc.xsl : line 23
(xsldbg) xsl:template > continue
Reached template :"/"
Breakpoint 1 Breakpoint in file xsldoc.xsl : line 23
(xsldbg) text > continue
Reached template :"header"
Breakpoint 2 Breakpoint in file xsldoc.xsl : line 67
(xsldbg) xsl:template > exit
Open an XML file into a buffer, then press <META>-x followed by entering "xsldbg-buffer" into the dialog xemacs provides. At the first prompt enter the file name of stylesheet to use. At the prompt for "Parameters" enter any extra parameters that you would normally provide to xsldbg via the command line.
After xsldbg-mode initializes you will have cursor highlighting the first line that xsldbg can debug. Use the right mouse button, the toolbar icon's or enter commands directly into xsldbg's command prompt. The right mouse button menu can be called up on text that is "highlighted".
To set a breakpoint you can print the list of templates and then right mouse click on the template name listed that you want to stop at. Or move the cursor to where you want a breakpoint (The start of a node in the XSLT source or XML DATA) then click the "Stop at selected position" icon.
The "Stop at selected function" button at the moment operates exactly the same as the "Stop at selected position" icon.
xsldbg is has built help system using xml/xslt. To help an overview of commands type:
help
To get a more detailed information about a command type:
help help
See release notes associated with package.
Check https://xmlsoft.org/XSLT and https://mail.gnome.org/archives/xslt/ for current issues.
Ensure that libxslt was configured with at least:
--with-debugger=yes
See the README.md in downloaded package for more information.
Make sure that you set and exported the correct LD_LIBRARY_PATH
Make sure that you've configure the correct libxml and libxslt prefix in libxslt, and xsldbg.
Make sure that you have a version of libxslt that has debugging support enabled this is done by default un *nix but it handled manually under other platforms
xsldbg tries to find a line number near the current node. But sometimes it is unable to find a "parent" for the current node. This normally means the node is part of the document preamble, a comment node or text node.
This is unavoidable because of the way xsldbg interrupts libxslt execution.
It is left up to the user to provide a stylsheet to replace docs/en/searchhtml.xsl and docs/en/search.xsl. Contributions of better XSL for search database formatting would be appreciated.
At last count there was over twenty thousand lines of text in xsldbg, some of this is automatically generated. This is about the same size as the libxslt directory in the libxslt distribution.
If the prompt looks like:
(xsldbg) xsldbg_default_node >
For some reason xsldbg could not load or use the specified stylesheet or xml data file.
Try using the "source" or "data" commands and then "run".
For problems with this project or web site please use the bug tracking system provided by Source Forge
See sourceforge file downloads
Several of the File related commands are disabled for the moment.
When you do a ‘cat’ on the style source the output is white space stripped so it will look different to your original source files. This is NOT a "bug"! This is the default behaviour of the stylesheet processor of libxslt. This tool is intended to be used by other programs which can handle formatting the output. See also the ‘list’ command.
The format of search results needs to be fixed
The ‘stepup’ command is not accurate
Searching can take a while with large documents i.e. when debugging docbook.xsl
Both the stylesheet and xml data file will be reloaded each time xsldbg starts a "run". It is too complex to complex considering keeping track of which files are out of date
Libxslt and consequently xsldbg ca not handle NON_ASCII template matches
If an environment variable is used to indicate where you've installed xsldbg's documentation the variable value MUST end in a path separator ie for win32 this is a '\', for *nix this is a '/'
The SGML/XML catalogs provided are to be included as a "nextCatalog" in your catalog file. Otherwise you'll get warnings about unable to find xsldbg's DTDs
The new search DTD allows for each element to have a comment to be extracted from the XSL source libxslt currently does not support this function
Under win32 the more command does not process a ".\<FILE_NAME>" properly
When a non ASCII character are used stylesheets the printing of search results does not print in the orginal encoding (instead uses UTF-8 ). This will be resolved if/when a replacement for the more command is made
add the ability to list documents created by xsl:document instruction (maybe?)
Look at replacing execution of shell command "more" with a function call
Look at allowing xsldbg to extract comments from XSL files to provided similar functionality as XSLTDoc tool by Fabrice Desré. At the moment the libxslt preprocessor strips most comments (maybe?)
validate the breakpoint API is complete :Done!
Update xsldbg when debugger support is built into libxslt. Done! libxslt only contains the code needed to call xsldbg. No further review by libxslt@gnome.org needed but may be done :-)
add the ability to validate file and line number
Redo configure and build scripts : Done!
Track down all sources of the crashes :-( : Done!
Complete line break points : Done!
Update documentation : Done!
Work on a patch for the xemacs module xslt-process to support debugging from within xemacs : Done! (modified gdb.el)
Create new functions to handle lists that are implemented as arrays. Done!
Break points to a specific line in the stylesheet are yet made stable : Done!
The debugger suffers from crashes "segmentation faults" which is being looked into : Fixed
The configure/build scripts need to be redone because they expect KDE to be installed : Done!
Confirmed that only the basic XSL/XSLT commands work. Which means that it may not stop where expected. Done!
Can only handle a fixed number of breakpoints. Fixed!
Does not handle a large number of variables/templates well. Fixed!
Does not allow libxslt parameters to be passed at xsldbg command prompt. Done!
Redo implemention of src/dbgbreakpoint.c to use hash tables not a fixed array of breakpoints Done!Add new search functions Done!
Add ability to change variables Done!
Only simple simple XSL commands are supported as yet.: Fixed!. But yet to verify that all commands work as expected
Allow xsldbg's configuration to be loaded/saved . Done!
http://xsldbg.sourceforge.net/ : Helping understand stylesheets
Last updated 20th October 2018