|
Home >Online Product Documentation >Table of Contents >Example of Debugging Java Files Example of Debugging Java FilesStylus Studio includes sample files that you can experiment with to learn how to use the debugger with an application that includes stylesheets and Java files. To get you started, this section provides step-by-step instructions for using the debugger with these sample files. You should perform the steps in each topic in the order of the topics. For complete information about how to use the debugger, see Debugging Stylesheets. This section includes the following topics: Setting Up to Debug Sample Java/XSLT Application
To set up Stylus Studio to debug the sample Java/XSLT application:
1. From the Stylus Studio menu bar, select Tools > Options.
2. In the Options dialog box that appears, click Java Virtual Machine.
3. If the examples\javaExtension directory is already in the ClassPath field, click OK.
If the examples\javaExtension directory is not in the ClassPath field, click Browse
next to the ClassPath field. In the Browse for Folder dialog box that appears, navigate to and select the javaExtension directory, which is in the examples directory of your Stylus Studio installation directory. Click OK. Restart Stylus Studio. For ClassPath changes to take effect, you must restart Stylus Studio whenever you modify the ClassPath field.
4. In the File Explorer, navigate to the examples\javaExtension directory in your Stylus Studio installation directory.
5. Double-click IntDate.xsl.
Stylus Studio opens the IntDate.xsl stylesheet in the XSLT editor. The tree for the XML source document, IntDate.xml, also appears.
6. In the XSLT editor tool bar, click Preview Result
.
The IntDate scenario has already been defined. Stylus Studio applies the stylesheet and displays the results (a list of dates) in the Preview window.
Inserting a Breakpoint in the Sample Java/XSLT Application
u To insert a breakpoint in the sample stylesheet:
1. In the XSLT editor, examine the template that matches the date element.
As you can see, the select attribute in the xsl:value-of instruction invokes the IntDate Java extension function.
2. In the body of the template, click just before the xsl:value-of instruction.
3. In the Stylus Studio tool bar, click Toggle Breakpoint
.
4. Press F5 to apply the stylesheet.
Alternative: In the Stylus Studio tool bar, click Start Debugging
.
The XSLT processor suspends processing at the breakpoint, displays a yellow triangle to indicate where processing has been suspended, and displays a message in the Preview window.
Gathering Debug Information About the Sample Java/XSLT Application
To obtain debug information:
1. In the Stylus Studio tool bar, click Step into
or press F11.
Stylus Studio opens and displays the Java source file that contains the IntDate extension function. Now the Variables window displays a list of the variables in the extension function. There is still no output in the Preview window.
Stylus Studio might display the Browse For Folder dialog box. It is prompting you to specify where it can find the Java source file that contains the extension function invoked in the line that has the breakpoint. Stylus Studio does not display the Browse for Folder dialog box when the .java file is in the same directory as the .class file. Click the javaExtension directory and click OK.
2. In the Stylus Studio tool bar, click Output Window
.
Stylus Studio displays the Output Window, which displays output from the Java virtual machine.
3. In the Stylus Studio tool bar, click Step Over
or F10 to move to the next line of Java code.
The yellow triangle moves to show the new location. If the values of the variables change, the Variables window reflects this.
4. Press Step Out
to return to the stylesheet.
The Variables window now displays only the context node. Processing was suspended when the second date child element of the doc document element was the context node.
The Preview window now displays a few lines of HTML.
5. In the Preview window, click in the first line of text.
Stylus Studio displays the Backmap Stack window, which contains a list of the XSLT instructions that have been executed. Also, in the XSLT Source tab, Stylus Studio displays a blue triangle that indicates the line in the stylesheet that generated the output line you clicked in.
|