You are on page 1of 11

PRINT FROM SAP HELP PORTAL

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.

PUBLIC 2013 SAP AG or an SAP affiliate company. All rights reserved.

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

Starting and Exiting a Debugging Session


Use
Using the XSLT debugger, you can inspect the execution of an XSLT transformation in debugging mode. To start a debugging session, you need to set at least one breakpoint in the XSLT program. After that you need to call the XSLT transformation either using the test environment or, from an ABAP program, using the CALL TRANSFORMATIONstatement.

Unlike the

ABAP Debugger, you cannot start the XSLT Debugger directly.

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

Exiting a Debugging Session


There is no explicit function for closing a debugging session. To close the debugger at any point, proceed as follows: 1. Delete all breakpoints that appear after the currently executed line in the XSLT program. 2. In the application toolbar, choose with the quick info text Continue.

PUBLIC 2013 SAP AG or an SAP affiliate company. All rights reserved.

Page 2 of 11

User Interface of the XSLT Debugger


Main Screen
The user interface of the XSLT debugger consists of the following sections:

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.

XML Source Code Display


The display of the XML source code in the debugger has the following features: If the XML document has the special character indicating line breaks, they are displayed in the debugger, otherwise the system inserts an automatic line break (maximum after the 255th character on the line). The code page used determines the way the end of the line is displayed: Code Page Standard code pages (Unicode, Latin-1, EBCDIC Latin-1) Latin-2 All other code pages End of Line Indicator (paragraph indicator) (currency character) # (hash sign)

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.

PUBLIC 2013 SAP AG or an SAP affiliate company. All rights reserved.

Page 3 of 11

XSLT Program Display


The source code of the XSLT program is displayed as close to the original as possible. The display has the following features: Highlighting of the currently executed line Highlighting of all lines with breakpoints.

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 ().

PUBLIC 2013 SAP AG or an SAP affiliate company. All rights reserved.

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.

Opening the Breakpoint View


To open the breakpoint view, in the application toolbar, choose the pushbutton with the quick info text Breakpoints . You see a list of all the breakpoints that already exist in your current system session.

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.

PUBLIC 2013 SAP AG or an SAP affiliate company. All rights reserved.

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

Changing values of variables in the XSLT Debugger is currently not supported.

Activities

Opening the Variable View


To open the variable view, choose Variables. You see a tabular list of all variables for the current context.

The value of an object variable is displayed as an object ID.

PUBLIC 2013 SAP AG or an SAP affiliate company. All rights reserved.

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

Creating Breakpoints in XSLT Programs


Use
You use breakpoints to stop the execution of an XSL transformation immediately before a specific statement is called.

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

Creating Line Breakpoints


In the Transformation Editor, you can set a line breakpoint both in change mode and in display mode: 1. In the Object Navigator (transaction SE80), open the XSLT program you want to examine. The Transformation Editor starts. 2. Position the cursor on the line in the source code where you want to set the breakpoint. 3. In the application toolbar, choose with the quick info text Set Breakpoint. To set a line breakpoint in the XSLT debugger, proceed as follows: 1. Position the cursor on the line in the XSL source code where you want to set the breakpoint. 2. Double-click the selected line or, in the application toolbar, choose with the quick info text Set Breakpoint. If the selected line contains a non-executable statement, the breakpoint is automatically set on the next executable line. The new line breakpoint is included in the breakpoint list. If you double-click on a line that already contains a breakpoint, the system deletes the breakpoint.

Creating Template Breakpoints


You can stop the execution of the XML transformation at a particular template in an XSLT program. 1. In the XSLT Editor, choose Utilities Set/Delete Breakpoint . 2. Choose the Template radio button. 3. In the Template input field, enter the name of the template. 4. Choose Continue. If your entries are correct, the new breakpoint is added to the breakpoint list. Unlike line breakpoints, template breakpoints are not highlighted.

Creating Program Breakpoints


Program breakpoints allow you to start the debugger directly when you start the XSLT program. 1. In the XSLT Editor, choose Utilities Set/Delete Breakpoint . 2. Choose the Program Breakpoint radio button. 3. Choose Continue. See also: Saving Breakpoints Deleting Breakpoints

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

PUBLIC 2013 SAP AG or an SAP affiliate company. All rights reserved.

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

Note that choosing the pushbuttons

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.

PUBLIC 2013 SAP AG or an SAP affiliate company. All rights reserved.

Page 9 of 11

XSLT Debugger and ABAP Debugger


Switching from the ABAP Debugger to the XSLT Debugger
It is possible to start the XSLT Debugger either from the execution mode of the ABAP program, or from the ABAP Debugger. You can open the XSLT Debugger only if you have set breakpoints in the XSLT program. For more information, see Starting and Exiting a Debugging Session.

Switching from the XSLT Debugger to the ABAP Debugger


The situation is the same when you wish to switch from the XSLT Debugger to the ABAP Debugger. ABAP statements in an XSLT program (for example, CALLEXTERNAL or EXTERNAL-FUNCTION) make the system switch to the ABAP Debugger only if you have set a breakpoint in the called method or function module. For more information, see Starting the ABAP Debugger.

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.

Transformation in the Workbench

PUBLIC 2013 SAP AG or an SAP affiliate company. All rights reserved.

Page 10 of 11

PUBLIC 2013 SAP AG or an SAP affiliate company. All rights reserved.

Page 11 of 11

You might also like