Liquid Studio 2020
XSLT Editor/Debugger / XSLT Debugger Walk through
In This Topic
    XSLT Debugger Walk through
    In This Topic

    Introduction

    The Liquid XSLT Debugger makes it possible to step through an XSLT stylesheet, examining the internal state of variables and contexts as you go.

    This brief walk through will show you how to get started.

    Source Files

     

    1. Open Liquid XML Studio.

    You need the Trial, Designer or Developer Edition to debug XSLT stylesheets.
    The starter edition will not work.

    2. Open the stylesheet

    File->Open

    Select the file PersonToHtml.xslt

    3. Select the XSLT Debugger Engine

      Select the Debugger engine (only Saxon HE supports debugging at this time)

    4. Configure the XSLT Debugger

      Select the Debugger Options (). We need to configure the input/output files before we can run/debug the stylesheet.

     

    XSLT Debugger Options

     Set the Input->Context Input to be the source XML file PersonData.xml.

     Provide a filename for the stylesheet output to be written to Output->Filename.

     Set the output type. Ensure its set to HTML. Other values have an impact on the validation and formatting of the output file.

     Parameters can be passed to the stylesheet using the Input Values Tab. We will pass the parameter "Title" to the stylesheet, this will be come the HTML page title. It is also possible to use an XML file as the source for a parameter.

    5. Add a break point

     Breakpoints can be added to the stylesheet by pressing F9 or clicking in the editor margin.
    Add a breakpoint at line 26

     

     

    6. Start the Debugger

     Start the debugger using the Step Into button (), which will pause on the first instruction within the XSLT.

    Once the debugger is in the paused state, the current instruction is highlighted in yellow, and the local variables are displayed in the Variables window. Watch expressions are also re-evaluated.

     

    7. Continue to the next break point

     Pressing the Run button () causes the debugger to resume execution until the program completes or a break point is encountered.

    The execution should pause on the break point we created in step 5.

    The output file is opened in a separate pane when the stylesheet writes to it. The content of the output file are updated in real time as the stylesheet runs.

     The Local Variables window shows all the variables within the current context. We can see the input parameter Title, and the variable [Context] which contains the XML context node. This is used as the root for all XPath expressions.

     

    8. Create a Watch Expression

     Watch expressions can be added by right clicking in the watch window. Watch expressions allow dynamic expressions to be evaluated, ideal for proto typing or digging into data.

    Add a watch expression "lower-case(./name/text())", and see the result in the value column.

    Every time the debugger enters the paused state watch expression are re-evaluated.

     

     9. Run to the end.

    The run command (F5 or ) will cause the execution to resume. There are 2 Person entries in our sample file, and these have been sorted (see line 17) so the execution will stop again on line 26 within the context being the Person element John Smith. Notice the watch expression reflects the new context.

    Pressing Run again will cause the transform to complete.

    10. Notes About Debugger Settings.

    The settings for the debugger are stored in the current project. If no projects are open then the settings are stored in the default project. It is recommended that when working with XSLT's you create a project and include your stylesheet, input and output files. In this way you have quick and easy access to all the elements of your work.

     

    See Also