xsldbg 4.7.0
Overview
xsldbg is a text based tool to debug stylesheets (the eXtensible Stylesheet Language) and has
commands similar to the Unix/Linux debugger gdb. It has three major modes of execution of stylesheets.
|
Run the whole stylesheet |
Step to next xsl instruction |
Continue until next break point is found, or stylesheet has restarted |
|
On systems with readline library available you can
|
use the back/forward keys to navigate the history of entered commands |
use <tab> key to automatically complete values names such as file names when adding breakpoints |
|
On all systems the last entered command can be repeated by just pressing
the <ENTER> key.
If your operating system supports it file names will be expanded.
Note that the libxml2 library used support the following path types for XSLT/XML documents
|
<SomePath> |
file://<SomePath> |
http://<SomePath> |
ftp://[user[:password]@]host[:port]/path |
|
Normally support for http:// and ftp:// XML document paths enabled in libxml2. When specifier http:// or ftp:// document paths ensure that host maps to IPv4 or IPv6 address used by related server. For
example instead of localhost you may need to use the IPv4 address 127.0.0.1
Several commands take more that one argument. Some arguments can be
surrounded by quotes to complex argument to be proceesed as one
argument. eg break "* | @" would allow you to use a breakpoint on the
template with the name "* | @"
The following shows the legend of terms use in this manual and there meaning
|
TEMPLATE_NAME : A valid template name contains only ASCI character codes 0x00 to 0x7F. And can be a fully qualified name ie "xsl:templateName". |
FILENAME : A valid file name local to the system of the user. It can have a "~" prefix on *nix and CYGWIN platforms. Or environment variables under RISC OS |
URI : A Uniform Resource Identifiers as defined by RFC 2396 |
MODE_NAME The mode of template which can be fully qualified name ie "xsl:modeName". |
QNAME : A fully qualified name ie "xsl:localPart" |
LINENO : A valid line number in associated <FILENAME> |
NUMBER_OF_FRAMES : A valid line number frames to change position by |
BREAKPOINT_ID : A valid break point number |
WATCH_ID : A valid watch expression number as indicated by showwatch command |
SPEED: speed to walk through code at, between 0 to 9 |
(Comment): a comment about command meaning or usage |
{ opt1 | opt2 | opt2 .. etc} : Choose one of the opt's |
XPATH : a xpath selection of node(s) |
PARAM_ID : a valid parameter number as indicated by showparam command |
PATH : A path to change working directory to On some operating systems a "~" prefix will be replaced by your home directory path |
TEXT : Free form text (no restrictions) |
COMMAND : A valid command for the xsldbg |
QNAME : A valid variable/parameter name |
SOURCE : The stylesheet being/to be executed. See <FILENAME> and <URI> |
DATA : The XML data(document) being/to be processed by the stylesheet. See <FILENAME> and <URI> |
DEVICE_PATH : Is a valid terminal on the operating system |
TTY_LEVEL : Is a valid level of input/output to use |
|
|
Help related :help |
Running related : {bye|exit|
quit}, step,
stepup, stepdown,
next,
continue, run,
trace, setoption,
options |
Libxslt parameter related : addparam,
delparam,showparam,
output, setoption,
options |
Template related : templates,
where, frame |
Break point related : break,
showbreak,delete,
enable |
Expression viewing(xpath) : cat |
Node viewing : ls, dir,
du, cat, pwd, addwatch, showwatch, delwatch |
Variable viewing : globals,
locals,
cat |
Variable setting: set |
Node selection : source,
data, cd |
Searching :search |
Operating system related :chdir,
shell,tty |
File related : output,
entities, system,
public |
Disabled file commands: validate,
load, save,
write, free |
|
Commands
Addparam |
Add a libxslt parameter |
Usage |
|
addparam <QNAME> <XPATH> (The <XPATH> must not contain any spaces nor double quotation marks.No error checking done on the validity of <QNAME> nor <XPATH>. This is equivalent to providing --param <QNAME> <XPATH> via command line.) |
add param <QNAME> "<XPATH>" (Must not contain double quotation marks in <XPATH>) |
|
Addwatch |
Add an expression to be watched. See showwatch for display watch values |
Shortcut name: watch
|
Base |
Print the base for this node |
Break |
Break at a template, at a location in a stylesheet or XML file loaded by xsldbg, or at the current node.
New for xsldbg 3.1.4: When in gdb compatabilty mode orpaned breakpoints can be set at a specific file and line number and be resolved to an active later on. |
Shortcut name: b
xsldbg will try to guess the complete URL given a
|
file name without a path specified. |
a file name in the same directory as the "top" stylesheet loaded |
a file name relative to the current working directory of xsldbg |
|
As example if you have loaded a stylesheet file of ../en/xsldoc.xsl you can do this:break -l xsldoc.xsl 26
This command will match a partial or complete QNAME template and or mode name provided. Eg "template" will match any QNAME with a local part of "template"
Any name spaces in the provided QNAME will be expanded as specified
by the names spaces defined in the XSL SOURCE file. eg "xsl:test1" will be expanded to "http://www.w3.org/199/XSL/Transform:test1"
A requested breakpoint may need to be resolved to its associated URL and line number. This is done automaticly after
the first template has been seen by xsldbg. Breakpoints are re-validated shortly after the start of each run.
Automatic breakpoint validation is used when gdb mode is enabled - the default behavior of xsldbg
|
Usage |
|
break -l <FILENAME> <LINENO> (To set breakpoint at specified file, line number) |
break -l <URI> <LINENO> (To set breakpoint at specified URI, line number) |
break <TEMPLATE_NAME> (To break at named or matched template.) |
break <TEMPLATE_NAME> <MODE_NAME> (To break at named template with given mode.) |
break "" <MODE_NAME> (To break at any template that has a given mode name) |
break * (To break at any template found.) |
break \* (To break at the "*" template. Other name that include '*' will not be treated specially.) |
break (To break point at current node. Yes that includes XML data nodes!) |
|
Bye |
Exit processing stylesheet as soon as possible. |
Cat |
Print the result of a xpath expression on relative current node. |
Usage |
|
Usage : cat <XPATH> (To view a variable or parameter) |
Usage : cat $<QNAME> |
|
Cd |
Change to the path specified by a xpath. |
Usage |
|
cd <XPATH> |
cd -t <TEMPLATE_NAME> (To changes current SOURCE node to a be xsl template with name <NAME>, but does execute source command) |
cd -s <XPATH> (An absolute xPath to node within stylesheet) |
cd <SHORTCUT> <XPATH> |
Where SHORTCUT can be either |
|
<< = preceding-sibling::node() |
>> = following-sibling::node() |
<- = ancestor::node() |
-> = decendant::node() |
|
|
|
Chdir |
Change the working directory |
Usage |
|
chdir <PATH> (A relative or absolute path for operating system) |
|
Continue |
Continue running stylesheet, stopping at any break points found. |
Shortcut name: c
|
Data |
Switch to displaying the current node in XML data. Or change XML data used |
Usage |
|
data (Switch to the current document node.) |
data <DATA> (To change to a new XML data file. A leading "~" is replaced by the $HOME environment variable value. Will need to use "run" command to process it) |
|
Delete |
Delete a template breakpoint |
Shortcut name: d
|
Usage |
|
delete (To delete breakpoint at current node) |
delete <BREAKPOINT_ID> (To delete breakpoint at specified break point number) |
delete -l <FILENAME> <LINENO> (Delete at specified file, line number) |
delete -l <URI> <LINENO> (Delete at specified URI, line number) |
delete <TEMMPLATENAME> (To delete break point at named template.) |
delete * (To delete all break points.) |
|
Delparam |
Delete a libxslt parameter |
Usage |
|
delparam (Delete all parameters present) |
delparam <PARAM_ID> |
|
Delwatch |
Delete a watch expression or remove all watch expressions as displayed by "showwatch." command |
Usage |
|
delwatch <WATCHID> (Delete a watch expression with given ID) |
delwatch * (Delete all watch expressions) |
|
Dir |
Print list of nodes in a similary way to the dir shell command. |
|
Disable |
Disable a breakpoint |
Usage |
|
disable (To disable breakpoint at current node) |
disable <BREAKPOINT_ID> (To disable breakpoint at specified break point number |
disable -l <FILENAME> <LINENO> (Disable breakpoint at specified file, line number) |
disable -l <URI> <LINENO> (Disable breakpoint at specified URI, line number) |
|
Du |
Print a summary of child nodes in a tree format. |
Dump |
Dump the gory details of this node |
Enable |
Enable or disable a breakpoint (Toggle enable/disable/) |
Shortcut name: e
|
Usage |
|
enable (To enable/disable breakpoint at current node) |
enable <BREAKPOINT_ID> (To enable/disable breakpoint at specified break point number |
enable -l <FILENAME> <LINENO> (Enable/disable breakpoint at specified file, line number) |
enable -l <URI> <LINENO> (Enable/disable breakpoint at specified URI, line number) |
|
Entities |
Print list of external General Parsed entities used data file (document) |
Shortcut name : ent
|
Usage |
|
entities |
entities -r (Also print fully resolved URI for General Parsed entities) |
|
Exit |
Exit processing stylesheet as soon as possible. |
Frame |
Print the stack frame at a given depth |
Shortcut name: f
|
Usage |
|
frame <FRAME_DEPTH> (Depth is a number from 0 to the current depth of call stack) |
|
Free |
Free stylesheet and data (Disabled see run) |
Globals |
Print a list of global stylesheet variables or parameters. Print the value of a global variable |
Usage |
|
globals (Print list of all globally available variables) |
globals -f (Print list of all globally available variables and their values) |
globals <QNAME> (Print the value of variable specified) |
|
Help |
Display help on command or overview |
Shortcut name: h
|
Usage |
|
help (Show overview of product) |
help <COMMAND> (Show help about a command) |
|
Load |
Load the xsldbg's options and user preferences from disk |
Locals |
Print a list of local stylesheet variables or parameters. Print the value of a local variable |
Usage |
|
locals (Print list of all locally available variables) |
locals -f (Print list of all locally available variables and their values) |
locals <QNAME> (Print the value of variable specified) |
|
Ls |
List nodes in a brief format |
Next |
Skip over an xsl:call-template or xsl:apply-templates.
This command has the same effect of entering the commands "step" and then "up" |
Shortcut name: n
|
Usage |
|
next (proceed to next sibling instruction) |
|
Options |
Print the values for xsldbg's option |
Output |
Specify the output file name |
Shortcut name : o
|
Usage |
|
output <FILENAME> (A local file name. Which can have a "~" prefix on *nix and CYGWIN platforms. Or environment variables under RISC OS) |
output <URI> (The <URI> must only use the "file:///" protocol. This is then converted to a file name suitable for the operating system) |
output - ( Send to standard output. Must only be used when using xsldbg's command line prompt ) |
|
Public |
Print the value that a public ID maps via the current catalog |
Shortcut name : pub
|
Pwd |
Print the current working directory. |
Quit |
Exit processing stylesheet as soon as possible. |
Shortcut name: q
|
Run |
Restart the stylesheet. |
Shortcut name: r
|
Save |
Save the xsldbg's options and user preferences to disk |
Search |
Search a dataBase of all information gathered from stylesheets loaded |
All output files are stored in, value of the "searchresultspath" option if set, or the same directory as the provided stylesheet. searchresults.xml is normally transformed by search.xsl, but will be transformed using searchhtml.xsl if the "preferhtml" option is set.
When the search command is issued a XML file (searchresults.xml) will be created. You can then process this file with your own stylesheet to present data in a other ways. If "preferhtml" option is not set
then searchresult.txt is printed to display.
Depending on the amount of data collected it might take a while to complete this command.
|
Usage |
|
search <XPATH> (See what xpath can be used see search.dtd in documentation install path such as /usr/share/doc/packages/qt5/xsldbg/en/ . An example <XPATH> is '//search/variable' , the default <XPATH> is '//search/*' ) |
search -sort <XPATH> (Tell search.xsl to sort the result before saving it) |
|
Set |
Set the value of an already defined XSLT variable |
Usage |
|
set <VARIABLE_NAME> <XPATH> |
See also the following commands:globals,locals |
|
Setoption |
Set an option for execution of stylesheet |
*Note* The 'run' command must be used to apply and make new setting active
|
Usage |
|
Integer Options |
=============== |
setoption <OPTION_NAME> <INTEGER_VALUE> |
Where <INTEGER_VALUE> is *true* if it is *NOT* equal to zero |
Where <INTEGER_VALUE> is *false* if it *IS* equal to zero |
Where integer <OPTION_NAME> can be either |
|
debug (If <INTEGER_VALUE> is true dump the tree of the result instead) |
catalogs (If <INTEGER_VALUE> is true use the catalogs from $SGML_CATALOG_FILES or SGML$CatalogFiles for risc operating system |
html (If <INTEGER_VALUE> is true the input document is an HTML file) |
docbook (If <INTEGER_VALUE> is true the input document is SGML docbook) |
xinclude (If <INTEGER_VALUE> is true do XInclude processing on document input) |
preferhtml (If <INTEGER_VALUE> is true the prefer html output for search results. : See search command) |
autoencode (Try to use the encoding from the stylesheet) |
utf8input (All input from user is in UTF-8.This is normaly used when xsldbg is running as a thread) |
gdb (Run in gdb compatibility mode)
|
For a value of 1 this means
|
Print lots more messages. Increase the frequency of printing "Breakpoint at ..." |
At most GDB_LINES_TO_PRINT lines will be printed when evaluating expressions, followed by a "...". See options.h to change this value, the default is three lines of text |
Both local and globals will be printed when the "locals" command is issued |
When printing expressions with cat/print. The evaluated value will be prefixed by "= " < EXPRESSION > |
|
|
|
|
nonet (If <INTEGER_VALUE> is true refuse to fetch DTDs or entities over network) |
novalid (If <INTEGER_VALUE> is true skip the DTD loading phase) |
repeat (If <INTEGER_VALUE> is true run the transformation 20 times) |
profile (If <INTEGER_VALUE> is true dump profiling informations) |
timing (If <INTEGER_VALUE> is true display the time used) |
noout (If <INTEGER_VALUE> is true do not dump the result) |
|
|
stdout (Print all error messages to stdout. Normally error messages go to stderr.) |
setoption <OPTION_NAME> "<STRING_VALUE>" (Must not contain double quotation marks in <STRING_VALUE>) |
String Options |
=============== |
setoption <OPTION_NAME> <STRING_VALUE> (Must not contain any spaces, nor double quotation marks in <STRING_VALUE>) |
Where string <OPTION_NAME> can be either |
|
data (Data file's URI) |
source (Source file's URI) |
output (Output file's SystemID ) |
docspath (Path to use when looking for documentation) |
catalognames (The names of the catalogs to use when the catalogs option is set. Value will be lost if set before setting catalogs option) |
encoding (What encoding to use for standard output) |
searchresultspath (What path is to be used when storing the results of searching. If this is not set then xsldbg will use the path of the stylesheet) |
|
|
|
Shell |
Execute shell command |
Usage |
|
shell <TEXT> (<TEXT> is the text to be passed to operating system for execution) |
|
Showbreak |
To display list of template break points. |
Shortcut name: show
If a mode exists on a template breakpoint then it will
be appended to the end of template name for breakpoint. An example of the output is :
|
Breakpoint 1 enabled for template: "*" mode : "" in file "test1.xsl" at line 101 |
Breakpoint 2 enabled for template: "*" mode : "testMode" in file "test1.xsl" at line 105 |
Breakpoint 3 enabled for template: "*" mode : "http://www.w3.org/1999/XSL/Transform:testMode" in file "test1.xsl" at line 105 |
|
Total of 3 breakpoints present |
|
|
Showparam |
Print the libxslt parameters present |
Showwatch |
Show the current expression being watched |
Shortcut name: watches
|
Usage |
|
showwatch (Show the currently selected watches and their values) |
showwatch 1 (Enable the automatic printing of watch expressions. This is used by default.) |
showwatch 0 (Disable the automatic printing of watch expressions.) |
|
Source |
Switch to displaying the current node in stylesheet. Or change stylesheet used |
Usage |
|
source (Switch to the current node in stylesheet.) |
source <SOURCE> (To change to a new source file. A leading "~" is replaced by the $HOME environment variable value. Will need to use "run" command to execute it) |
|
Step |
Step until next stylesheet instruction. |
Shortcut name: s
|
Stepdown |
Step down to a newer "call frame". |
Shortcut name: down
|
Usage |
|
stepdown (step down one frame) |
stepdown <NUMBER_OF_FRAMES> (step down specified number of frames) |
|
Stepup |
Step up to a older "call frame". |
Shortcut name: up
This is not an accurate command, xsldbg will stop as close as it can.
|
Usage |
|
stepup (step up one frame) |
stepup <NUMBER_OF_FRAMES> (step up specified number of frames) |
|
Stylesheets |
Print out a list of stylesheets loaded |
Shortcut name: style
|
System |
Print the value that a system file maps via the current catalog |
Shortcut name : sys
|
Templates |
Print a list of available templates. Search for a template |
Shortcut name: t
|
Usage |
|
templates |
templates <TEMPLATE> (Print details of templates matching <TEMPLATE> if it can be found) |
templates -q [<TEMPLATE>] (Print brief details of templates. If <TEMPLATE> argument is provided look for templates matching <TEMPLATE>) |
|
Trace |
Trace one execution of the stylesheet |
Tty |
Open a terminal. Set the level of tty redirection. |
Usage |
|
tty <DEVICE_PATH> (Where <DEVICE_PATH> is a valid terminal on the operating system. Just tries to open the terminal |
tty <TTY_LEVEL> (Set the level of tty redirection, where <TTY_LEVEL> is a valid level of input/output to use)
|
Where level is |
0 = Default input/output |
1 = Terminal output of results of transformation, tracing and walking (Default state when tty device has been opened. Not fully implemented yet.) |
2 = Full redirection to terminal (Not implemented yet.) |
All other integer values are assumed to mean level 0
|
|
|
|
Validate |
Validate the output file generated by stylesheet (Disabled) |
Walk |
Walk through code using a range of speeds |
Usage |
|
walk <SPEED> (Use Ctrl-c to stop execution, <SPEED> is a value between 0 and 9. Where 0 means stop, 1 is very fast, 9 is very slow) |
|
Where |
Print a trace of templates calls (frame stack) and print the working directory. |
Shortcut name: w
|
|
|