Professional Documents
Culture Documents
Document: XSLT Debugger URL: http://help.sap.com/saphelp_nw73ehp1/helpdata/en/78/84353c9a70a57be10000000a11402f/content.htm Date created: July 26, 2013
2013 SAP AG or an SAP affiliate company. All rights reserved. No part of this publication may be reproduced or transmitted in any form or for any purpose without the express permission of SAP AG. The information contained herein may be changed without prior notice. Some software products marketed by SAP AG and its distributors contain proprietary software components of other software vendors. National product specifications may vary. These materials are provided by SAP AG and its affiliated companies ("SAP Group") for informational purposes only, without representation or warranty of any kind, and SAP Group shall not be liable for errors or omissions with respect to the materials. The only warranties for SAP Group products and services are those that are set forth in the express warranty statements accompanying such products and services, if any. Nothing herein should be construed as constituting an additional warranty. SAP and other SAP products and services mentioned herein as well as their respective logos are trademarks or registered trademarks of SAP AG in Germany and other countries. Please see www.sap.com/corporate-en/legal/copyright/index.epx#trademark for additional trademark information and notices.
Note This PDF document contains the selected topic and its subtopics (max. 150) in the selected structure. Subtopics from other structures are not included.
Page 1 of 11
XSLT Debugger
Purpose
You use the XSLT Debugger to localize errors in XSL transformations.
Features
You use the XSLT debugger for: Step-by-step execution of the XSL transformation using different execution types Creating breakpoints (different options) Saving breakpoints for the duration of a system session Checking the result in different debugger views (result view, variable view, and so on) Switching to the ABAP Debugger after ABAP calls See also: Starting and Exiting a Debugging Session User Interface of the XSLT Debugger Breakpoints Ways of Debugging XSLT Debugger and ABAP Debugger
Unlike the
Prerequisites
The XSLT program to be examined is available as an active version. The XML document, which serves as a transformation source, is either mentioned in the SOURCE addition of the CALL TRANSFORMATION statement or you have uploaded the file in the test environment.
Procedure
Starting a Debugging Session
1. In the Object Navigator (transaction SE80), choose the XSLT program to be examined and start the Transformation Editor. 2. Position the cursor on the line where you wish to set a breakpoint. 3. In the application toolbar, choose respective XSLT transformation. You have started the XSLT debugger and can use the different debugging functions. with the quick info text Set Breakpoint. 4. Start the test environment for the XSLT transformation or the respective ABAP program that contains the CALL TRANSFORMATION statement for the
Page 2 of 11
Application Toolbar
The debuggers application toolbar allows quick access to different functions for controlling the debugging processes. For a detailed description of the individual functions, see Ways of Debugging.
Debugger Views
You can examine the status of the current XML transformation from various viewpoints. For that purpose, use the different views of the XSLT Debugger: Result View (switched on by default) Breakpoint View Call View Variable View.
The motivation behind this way of handling line breaks is the need to display XML source code as close to the original as possible. Blanks and line breaks are an important part of the XML source code. The currently processed XML node is highlighted.
Page 3 of 11
Result View
Use
You use this view to check the result of an XSL transformation in the XSLT Debugger. With the execution of each step involving a change in the result, the system automatically updates the output.
The result view does not display correctly transformations that result in ABAP data structures.
Features
Representation of Line Breaks in the Result View
To display real line breaks or blank characters necessary for formatting the output text, you need the corresponding XML statement in the XSLT program. If necessary, insert the following XSL statement (for example, in the beginning of the XSLT program):
<xsl:output indent="yes"/> The indents and line breaks mirror the hierarchy of the document structure and improve the readability of the output. Example In the following example the XSLT program returns an HTML document after the transformation. The output has real line breaks. As it is the case with standard code pages, end of line is marked by paragraph indicators ().
Page 4 of 11
<html> <body> <h1>Atomic Number versus Atomic Weight</h1> <table> <th>Atomic Number</th> <th>Atomic Weight</th> <tr> <td>Hydrogen</td> <td>1</td> <td
Breakpoint View
Use
You use the breakpoint view to get a list of all currently existing breakpoints.
Features
In the breakpoint view you can: Create different breakpoint variants Delete breakpoints Save breakpoints for the duration of the system session Navigate from the list to the breakpoint line with a double-click Sort and search the list of breakpoints.
Call View
Use
This view contains a tabular overview of the calls between different named blocks in an XSLT program. For example, if you set a breakpoint in a statement from a template that itself is called by another template, this call will be recorded in a call stack. Using this view, you can trace the sequence of reciprocal calls between different statement blocks and the call hierarchy.
Page 5 of 11
Activities
1. To open the call view, in the debugger, choose the 3. Choose Call Stack pushbutton. 2. Set a line breakpoint in an XSL template that itself is called by another template. Continue until the execution stops at the breakpoint you have set. The system displays the call list in a table with details about the correspond blocks.
Double-click a line in the table to access the corresponding line in the XSLT program.
Variable View
Use
Using the variable view, you can display the values of the variables in the examined XSLT program in tabular form. You can switch between different call levels (for example, after calling <xsl: apply-templates...>) and output the valid variables in the corresponding context.
Features
The variables are characterized by different variable types. Variable Type NodeSet Ordinary variables Fragment Object Fragments identify certain parts of the result tree. Fragment variables are used if the intermediate results of a result tree are linked to variables. The value of a fragment variable is not displayed. Their values are also not displayed. Refers to object types. An object ID or the name of the object type (name of an ABAP class) are used as a value of the object. Describes variables of the node set (tree nodes). The value of a NodeSet variable is not displayed. Includes variables of the types number, string, and Boolean. Description
Activities
Page 6 of 11
Additional Functions
Changing the call level (call sequence backwards/forwards). Navigation for variable of current statement. Sort and search functions.
Breakpoints
Use
A breakpoint in the XSLT program is a signal for the XSLT processor to interrupt processing at a certain point in the XSL source code. The XSLT debugger is activated only when this position is reached.
You can set breakpoints only in the source code of the XSLT program, not in the XML document.
Features
In the XSLT debugger, you can set the following types of breakpoints: Type of Breakpoint Line breakpoint Template breakpoint Program breakpoint Interrupts the execution of the transformation immediately before the first executable statement of the line. Each line breakpoint is identified uniquely by the line number. You can set line breakpoints both in the Transformation Editor and in the XSLT Debugger. Line breakpoints are highlighted. Interrupts the transformation immediately before a template is called by the system. To identify a breakpoint, you need to enter the name of the template. Template breakpoints are not highlighted. Interrupts the execution of the transformation when you call the XSLT program. Program breakpoints are identified solely by the name of the XSLT program and are created in the Transformation Editor. Description
When you explicitly save breakpoints, they remain active during the whole system session and are often called session breakpoints.
Activities
Setting Breakpoints Saving Breakpoints Deleting Breakpoints
Prerequisites
You can set breakpoints only in the source code of an XSLT program, not in an XML document. You can set breakpoints only for executable statements. Examples of non-executable statements are: End tags (for example: </table>) Top-level statements (for example: <xsl:template ... />). Top-level attributes are an exception.
Procedure
PUBLIC 2013 SAP AG or an SAP affiliate company. All rights reserved. Page 7 of 11
Saving Breakpoints
Use
If you want to leave the XSLT debugger temporarily, you can save your breakpoints. This ensures that breakpoints are still available when you open the debugger again within the same system session.
Prerequisites
You have opened the XSLT Debugger.
Procedure
1. To open the breakpoint view, choose the Breakpoints pushbutton. 2. Delete any unnecessary breakpoints. 3. In the standard toolbar, choose with the quick info text Save Breakpoints .
Result
The system saves all currently set breakpoints in the examined XSLT program. When you start the debugger during the same system session, these breakpoints are listed in the breakpoint list, irrespective of which XSLT transformation is being tested. Breakpoints that have been saved remain active until you delete them or log out of the system.
Deleting Breakpoints
Use
Page 8 of 11
You use this procedure if you want to save some specific breakpoints or need to limit the number of breakpoints.
Prerequisites
You can only delete breakpoints in the current XSLT program.
Procedure
1. To open the breakpoint view, in debugging mode, choose the Breakpoints pushbutton. 2. To delete selected breakpoints in the current XSLT program, select them and choose CTRL or SHIFT key. 3. To delete all the breakpoints in the current XSLT program, choose All Program Breakpoints . Selected Program Breakpoints. For multiple selection, use the
If you select breakpoints belonging to another XSLT program, the system displays a message informing you that these breakpoints cannot be deleted. 4. In the standard toolbar, choose Save Breakpoints .
Ways of Debugging
Use
In debugging mode, you can analyze the source code of an XSLT program in different execution modes. The pushbuttons on the application toolbar give you quick access to the corresponding functions.
Features
The table below gives a detailed description of the individual execution types: Icon / Key Combination Single Step F5 Execute F6 Return F7 Source CTRL + F8 Result SHIFT + F8 Continue up to the next source node Continue up to the next result change Continue F8 Create or SHIFT + F4 delete breakpoint Display CTRL + F4 current line Displays the line where the cursor currently is. Executes the XSL transformation up to the next breakpoint. If there are no more breakpoints in the XSLT program, choosing this pushbutton closes the debugging mode as soon as the current line is processed. The XSL transformation is executed up to the end. Inserts a line breakpoint at the line where the cursor is. If the line does not contain an executable statement, the breakpoint is inserted at the next executable line. If there is already a breakpoint at that line, choosing this pushbutton removes it. Executes the XSL transformation from the current position up to the next change in the result. This function allows you to process the tree hierarchy of the XML document step by step. When you choose the pushbutton, the XSL transformation is executed from the current position up to the next node in the XML tree. The debugger executes the whole XSL statement. If the statement contains multiple steps, they are executed in one go. This function is important for statements like <xsl:apply-templates /> and <xsl:call-template>, or when you call named blocks (templates, functions and so on). This function is provided for all situations where you wish to leave the current template and return to the calling template. Executes the XSL transformation statement by statement. Function Description
Single step or
Execute does not always result in a visible change. This is due to the logic of the XSLT processor.
Some steps in the XSLT processor are not visible (for example, if tag attributes need to be created). In such cases, you must push the respective pushbutton several times in succession before you see any change the XSLT program display, in the XML document display, or in the result view.
Page 9 of 11
Case Example
The following scenario demonstrates the flow of a typical debugging session based on the interaction between the ABAP Debugger and the XSLT Debugger.
You start an ABAP program in debugging mode. The program is executed up to the point where the transformation is called. Since the called XSLT program (in our case: TRANS) contains breakpoints, the XSLT Debugger starts and the execution of the transformation stops at the first breakpoint. If you continue processing the XSL source code until you reach an ABAP method call (call-external) , the system switches to the ABAP Debugger (if the method that is called (in our case: M1) contains a breakpoint). At this point, you can continue to execute the program by pressing F8. Then you return again to the XSLT Debugger. The line after the external method call is now the current line in the XSLT program. After the end of the transformation, you return to the ABAP Debugger. The current line is now the line after the calling point in the transformation.
Page 10 of 11
Page 11 of 11