The Wayback Machine - https://web.archive.org/web/20121001055246/http://www.oxygenxml.com:80/xml_developer/xslt_debugger.html
  • Like it

XSL / XSLT Debugger

XSLT Debugging Perspective

<oXygen/> provides a special layout when entering in debugging mode to show the XML source and the XSLT stylesheet documents side by side and to show also the results and special XSLT debugging views and toolbars. The perspective allows you to use the common XML and XSLT editor features. XPath dynamic evaluation, step into XSLT functions called from XPath 2.0 expressions, templates and nodes stacks are just a few of the information presented in the debugging perspective.

Oxygen XSLT Debugger

Multiple XSLT Engine Support

<oXygen/> offers XSLT debugging support based on the most used XSLT processors: Xalan-J and Saxon. Due to the open source architecture, they are more stable and bug free than proprietary XSLT processors, and the most important: they are true XSLT 1.0 compliant. Our XSLT debugger bundles the Saxon 6.5.5, Saxon EE and Xalan 2.7.1 transformation engines. Selecting the processor is very simple and involves changing the selection in the XSLT processor combo box. Although the processors are very similar, sometimes they produce different output for the same input, so it is best to test your XSLT stylesheets using the same processor type you are using in production.

Full Control Over the XSLT Debugging Process

<oXygen/> provides all XSLT debugger capabilities: step into, step over, step out, run, run to cursor, run to end, pause, stop. The current XML and XSLT node reached by the debugging process are shown (see the right part in the image below) with the following details: an arrow icon to show the action performed on it (entering/leaving), the name, the resource and the line. By clicking the arrow the text sections corresponding to the XML and XSLT stylesheet nodes are highlighted in the editor.

Control toolbar

Output Result is Linked to the Generating XSLT Element

Allows you to easily find out what element from the XSLT stylesheet generated a section of the output. For this you just have to click on the output text, either in the plain text result panel or in the XHTML preview panel. The editor will highlight the line in the stylesheet that generated the output. This allows you to find out immediately what template did not fire correctly.

The following image shows a schema of the debugging perspective, with the XSL source at the top and the output in the middle. The "Worker" string was generated by the "xsl:value-of" element, having as XML context node the "person" element.

Output is linked to the XSLT element

Mapping from the Output to the XSLT Templates Stack

In case of complex transformations, inspecting the entire stack of XSLT templates, that were active at the time the output fragment was generated, speeds up the debugging process. Just enable the Output to Source Mapping on the debugger toolbar, and click an area of the output text to see the templates stack in the Output Mapping Stack view.

XSLT Templates Stack for Output to Source Mapping

Pause the Debugger Execution with Breakpoints

Breakpoints can be set on both XML or XSLT documents used in the transformation. The breakpoints appear in the left bar of the XML and XSLT editors, as a red dot, and they can be created easily by using the shortcut key or by clicking the breakpoints area.

XSL Breakpoints

A condition can be attached to a breakpoint set in the Debugger perspective. The XSLT debugger will stop only if the condition evaluate to true. If there is no associated condition, the debugger will always stop at the breakpoint line.

Break Conditions

XSLT Call Stack View

The current stack containing both XSLT stylesheet and XML source nodes can be seen at any time during XSLT debugging. The advantage of this approach is that the source scope on which a stylesheet instruction is being executed (the last red coloured node on the stack) is easily visible.

Call stack

Trace History View

Entering and leaving node events are logged and made available in a view to show the history of the processor execution. You can click the entries in the list to see the corresponding node into the editor.

Trace history

Save the Debug Trace

It is possible to save the element trace obtained from a debug session as XML. This permits comparing different debug runs.

Save XSLT trace

XPath Watch View

You can add custom XPath expressions to the Watch View . The XPath expressions are evaluated automatically and the XSLT debugger updates the values dynamically as the processor changes its XML source context. The results of an evaluation can be a single value, a tree fragment or a list of nodes and are presented in the Node Set View. The watches are useful when debugging the expressions for template matches.

XPath Watch

Tree View For Presenting Node Set Values

The current context node value or the values of variables or XPath expressions that are evaluated to tree fragment or list of nodes are presented in tree views, thus giving access to the whole variable content. This is useful especially in debugging stylesheets that keep intermediary results in variables like DocBook for instance.

The user can easily locate the nodes from the tree by simply clicking on them: the editor will select the corresponding XML source nodes.

Nodes values view

Support for Imported/Included XSLT Stylesheets and XML Entities

Once a node from an XML entity or an imported/included XSLT stylesheet is processed by the transformation engine, the editor will open that resource in order to highlight the current node location.

XSLT Templates View

The list with all the XSLT templates used during the transformation and their corresponding number of calls are presented in the XSLT templates view. This allows to spot unused templates and the most frequently used templates as they are ordered based on the hits count.

XSLT Variables View

The debugger lists all XSLT variables and parameters that are visible in the current XSLT context together with their scope and actual value. The view is updated as the XSLT processor changes the context during the transformation.

Variables and parameters view

Dynamic XSLT Output Generation

The output is dynamically presented as it is generated by the XSLT transformation process. The user can examine directly the output as XML source or rendered as XHTML.

Capture Multiple Outputs In The XSLT 2.0 Debugger

While executing XSLT 2.0 stylesheets the debugger will capture the output of xsl:result-document and will present it in a view inside <oXygen/>.

Multiple Outputs in XSLT 2.0

Scenario Based XSLT Debugging Session

<oXygen/> has a powerful transformation support based on reusable scenarios. The same scenarios can be used for debugging. The XSLT Debugger will be initialized with the information from the scenario (source or stylesheet location, XSLT processor, transformation parameters) when the Debug scenario action is executed. This allows to easily manage and trigger different debugging sessions.

XSLT Profiler

You can profile your XSLT stylesheets to identify the performance issues using two comprehensive data views of the activated templates: an Invocation tree view and a Hotspots view. The profiling information can be saved to XML or HTML formats.

The profiling is available for the following XSLT processors that are bundled with <oXygen/>: Saxon 6.5.5, Saxon EE, and Xalan 2.7.1. Thus you can profile both XSLT 1.0 and XSLT 2.0 stylesheets.

Invocation tree view

Using invocation tree view, also named call tree, you can examine how style instructions are processed in a top down manner. The profiling result shows the duration time for each of the style-instruction including the time needed for its children and then, when an instruction is expanded, you can see how the instruction time is composed from child instruction times.

Invocation tree view

Hotspots view

Using profiler hotspots view, you can immediately detect the time the processor spent in each instruction. The hotspot only presents the inherent time of the instruction, that is the total time of processing that instruction minus the time for processing its children instructions. When a hotspot is expanded one can see all the different paths that instruction was called from (a reverse invocation tree), each path being labeled with the number of invocations, the instruction time on that path and what percentage from the instruction total execution that path contributes.

Hotspots view
  • oXygen XML Developer
  • oXygen XML Developer

    Starting from $349

Upcoming Events
DITA Europe 2012
November 12-13, 2012
Frankfurt, Germany
oXygen-Users Meetup Frankfurt 2012
November 11, 2012
Frankfurt, Germany
The LavaCon Conference
October 7–9, 2012
Portland, Oregon, USA
TCWorld 2012
October 23-25, 2012
Wiesbaden, Germany
Oracle OpenWorld 2012
September 30-October 4, 2012
San Francisco, CA
" oXygen is the premier text editor for XML geeks, and an indispensable tool for O'Reilly's Production group. My team uses oXygen for everything from simple XML editing to Schema validation and XSLT transformations. The digital production staff especially loves oXygen's built-in EPUB support, which eliminates a great deal of the grunt work that is usually entailed in editing EPUB files. The more we use oXygen, the more realize what a powerful tool it can be in digital and XML-based workflows."
Adam Witwer
Director of Content and Publishing Operations
O'Reilly Media
HTTPS · web.archive.org
← Home