Tracepoints

www.altova.com Print this Topic Previous Page Up One Level Next page

Home >  User Guide and Reference > XSLT/XQuery Debugger and Profiler > XSLT and XQuery Debugger >

Tracepoints

The XSLT and XQuery Debugger enables you to define tracepoints in XSLT documents.

 

Tracepoints allow you to trace content generated by an instruction or view the result of an XPath expression at the point where the tracepoint is set without having to edit the XSLT stylesheet, for example, using the xsl:message element to output debugging messages.

 

Tracepoints are displayed as a dashed blue line in XSLT stylesheets (shown in the screenshot below).

 

Note:It is possible to set a tracepoint and a breakpoint for the same instruction. This appears as a dashed blue and red line (see screenshot).

dbg_tracepoint

The debugger outputs the content generated by each instruction that has a tracepoint set for it. This output is visible in the Trace window. You can set any number of tracepoints in an XSLT stylesheet.

 

Note:Tracepoints set for a document remain in that document until it is closed.

 

Tracepoints in XSLT documents

You can set tracepoints on XSL instructions and literal results in an XSLT stylesheet.

 

Tracepoints in XML and XQuery documents

You can set tracepoints in XML and XQuery documents.

 

Inserting/removing tracepoints

To insert a tracepoint:

 

1.Place the cursor at the point in the XSLT document where you wish to insert the tracepoint. During debugging sessions, you can set tracepoints in both Text View and Grid View.
2.Do one of the following:

 

Select XSL/XQuery | Insert/Remove Tracepoint.
Press Shift+F9.
Right-click and select Insert/Remove Tracepoint.

 

To remove a tracepoint:

 

1.Place the cursor at the point in the XSLT document containing the tracepoint.
2.Do one of the following:

 

Select XSL/XQuery | Insert/Remove Tracepoint.
Press Shift+F9.
Right-click and select Insert/Remove Tracepoint.

 

Alternatively, you can use the XSLT Breakpoints / Tracepoints dialog to remove a tracepoint:

 

1.Select the menu option XSL/XQuery | Breakpoints/Tracepoints....
2.Click the tracepoint in the dialog box (see screenshot) and click Remove.

xsl_break2

The Remove All button in the Tracepoints pane deletes all the tracepoints from the dialog box (and from all XSLT stylesheets).

 

Setting an XPath for a tracepoint

You can set an XPath for a tracepoint. When you set an XPath for a tracepoint, the result of the evaluation of the XPath is displayed in the Trace window instead of the  content generated by the statement for which the tracepoint is set. The XPath is evaluated relatively to the context node at the point where the tracepoint is set.

 

To set an XPath for a tracepoint:

 

1.Select the menu option XSL/XQuery | Breakpoints/Tracepoints.... This opens the XSLT Breakpoints / Tracepoints dialog box which displays the currently defined tracepoints in all open XSLT stylesheet documents.
2.Enter the XPath in the XPath column in the row that corresponds to the tracepoint.

 

Example

In the example below, the tracepoint is set such that the context node is Person. The Person element contains a Shares element. We want to display the number of shares that each person has, multiplied by 125 (the value of each share).

xpath_result

Do the following:

 

1.Set a tracepoint at the line just after the xsl:for-each instruction that selects the n1:Person element (line 555 in the screenshot above).
2.Open the XSLT Breakpoints / Tracepoints dialog and enter the XPath n1:Shares*125.00 for the tracepoint you just set.

breaktracedlg_xpath

3.Start the Debugger. The results of the XPath you entered for the tracepoint appear in the Trace window.

 

The Trace window

Select XSL/XQuery | Start Debugger/Go to start debugging. The output of instructions for which tracepoints are set is displayed in the Trace window (see screenshot). Click a row in the Trace window to display the full result of that statement in the right side of the window (see screenshot).

 

Please note: Results are displayed in the Trace window only after the traced instruction is completed.

trace_window

 

Disabling/enabling tracepoints

After inserting tracepoints, you can disable them if you wish to skip over them without having to delete them. You can enable them again when necessary.

 

To disable a tracepoint:

 

1.Place the cursor at the point in the XSLT stylesheet containing the tracepoint.
2.Select XSL/XQuery | Enable/Disable Tracepoint (or press Ctrl+Shift+F9). The tracepoint changes from blue to gray, indicating that it has been disabled.

 

Alternatively, you can use the XSLT Breakpoints / Tracepoints dialog to disable a tracepoint:

 

1.Select the menu option XSL/XQuery | Breakpoints/Tracepoints.... This opens the XSLT Breakpoints / Tracepoints dialog box which displays the currently defined tracepoints in all open XSLT stylesheet documents.

xsl_break2

 

2.Remove the check mark of each tracepoint you wish to disable, and click OK to confirm. The tracepoints change from blue to gray, indicating that they have been disabled.

 

To enable a tracepoint:

 

1.Place the cursor at the point in the XSLT document containing the tracepoint.
2.Select XSL/XQuery | Enable/Disable Tracepoint (or press Ctrl+Shift+F9). The tracepoint changes from gray to blue, indicating that it has been enabled.

 

Finding a specific tracepoint

To find a specific tracepoint:

 

1.Select the menu option XSL/XQuery | Breakpoints/Tracepoints.... The XSLT Breakpoints / Tracepoints dialog appears.
2.Click the required tracepoint in the tracepoint list.
3.Click the Edit Code button. The XSLT Breakpoints / Tracepoints dialog box is closed and the text cursor is placed directly in front of the tracepoint in Text view of the XSLT document. In  Enhanced Grid view, the table cell containing the tracepoint is highlighted in blue.

 


© 2019 Altova GmbH