Viewing Processing Information

Stylus Studio provides several tools for viewing processing information when you suspend processing. The tools become active when processing reaches a breakpoint. This section discusses the following topics:

Watching Particular Variables

Use the Watch window to monitor particular variables. To display the Watch window, click Watch in the Stylus Studio tool bar. This button is active when Stylus Studio suspends processing because it reached a breakpoint. Stylus Studio displays the Watch window only when processing is suspended.

Enter the names of the variables you want to watch. You can enter as many as you like. In a Java program, you can double-click a symbol and drag it to the Watch window to enter it as a variable you want to watch. When Stylus Studio suspends processing, it displays the current values for any variables listed in the Watch window. You can expand and collapse complex structures as needed.

Another way to obtain the value for a variable is to hover over the symbol in your stylesheet or Java program. Stylus Studio displays a pop-up box that contains the current value.

During XSLT debugging, you can enter XPath expressions in the Watch window fields. Stylus Studio uses the current context to evaluate these expressions, and displays the results with the same kind of interface Stylus Studio uses for nodeList and node variables.

Evaluating XPath Expressions in the Current Processor Context

When you suspend processing, you can evaluate an XPath expression in the context of the suspended process. You do this in the Watch window. Click in the Stylus Studio tool bar to display the Watch window. Click in an empty name field and enter an XPath expression. As soon as you press Enter, Stylus Studio displays the results of the evaluation in the Value field of the Watch window.

Obtaining Information About Local Variables

Display the Variables window to obtain information about local variables. To display the Variables window, click Variables in the Stylus Studio tool bar.This button is active when Stylus Studio suspends processing because it reached a breakpoint. Stylus Studio displays the Variables window only when processing is suspended.

For stylesheets, Stylus Studio displays

  • A path that shows which node in the stylesheet was being processed when processing was suspended
  • Local and global XSLT parameter values
  • Local and global XSLT variable values

Also, you can navigate the structure associated with a variable, a parameter, or the current context if it is a node list or a node.

For Java classes, Stylus Studio displays

  • Local variables that are defined at that point in the processing and their values.
  • Function parameters and their values.
  • A special variable named this. The this variable represents the object being processed. It allows you to drill down and obtain additional information.

You can expand and collapse complex structures as needed.

Determining the Current Context in the Source Document

When you are debugging a stylesheet, the Variables window displays a path for the current context. This is the set of nodes that the XSLT processor is currently working through. This allows you to examine the nodes that lead to the context node.

Displaying a List of Process Suspension Points

Display the Call Stack window to view a list of the locations at which processing was suspended. To display the Call Stack window, click Call Stack in the Stylus Studio tool bar. This button is active when Stylus Studio suspends processing because it reached a breakpoint. Stylus Studio displays the Call Stack window only when processing is suspended.

For stylesheets, Stylus Studio displays the template name and line number. For Java classes, Stylus Studio displays the class name, function name, parameters, and line number.

When processing is complete, the call stack is empty.

When execution is suspended you can use the Call Stack window to jump directly to the XSLT or Java source. Double-click on a stack line to go to that location. A green triangle appears to indicate this location in the source file.

The Call Stack window and the Backmap Stack window provide the same kind of information. However, the Backmap Stack window never shows Java entries, and the contents of the Backmap Stack window can be different from the Call Stack window according to where you click in the output to enable backmapping.

Displaying XSLT Instructions for Particular Output

After you apply a stylesheet, or during debugging of a stylesheet, Stylus Studio can display the XSLT instruction or the sequence of XSLT instructions that generate a particular part of a result document. This can be particularly helpful when the result is not quite what you want.

To view XSLT instructions:
1. Open a stylesheet.
2. Apply the stylesheet.
3. In the Preview window, in either the text view or the browser view, click on the output for which you want to display the XSLT calls.

Stylus Studio displays the Backmap Stack window, which lists one or more XSLT instructions. Also, Stylus Studio flags the line in the stylesheet that contains the first instruction in the list. To find the location of another listed instruction, click that instruction in the Backmap Stack window.

The Call Stack window and the Backmap Stack window provide the same kind of information. However, the Backmap Stack window never shows Java entries, and the contents of the Backmap Stack window can be different from the Call Stack window according to where you click in the output to enable backmapping.

 
Free Stylus Studio XML Training: