XSL Outline Window
In the XSL Outline Window (screenshot below), all templates and functions in the active XSLT document are listed. Templates are indicated with blue icons ( templates without a parameter; and templates containing parameters). Functions are indicated with a red icon. In the combo box in the bottom left-hand of the window, you can select whether the templates and functions listed are from: (i) only the active XSLT document (as in the screenshot below), or (ii) the active XSLT document and all included and imported stylesheets.
There are two types of templates: (i) named templates, and (ii) templates that match an XPath expression. Each template is listed with:
•Its name (if the template has a name attribute) and/or XPath expression (if the template has a match attribute). If the template has both, a name and a match attribute, then both are listed, with the value of the name attribute first: namevalue, matchvalue (see the template named bold in the screenshot above).
•Its mode, if any. Note that a template may have more than one mode (see screenshot above).
•Its priority, if any;
•The comment that directly precedes the template or function, if any.
Functions in the stylesheet are listed by their names. Functions have neither mode nor priority.
The following operations can be performed in the XSL Outline Window:
•Filtering: The list displayed in the window can be filtered to show one of the following: (i) all templates and functions (the default setting each time XMLSpy is started); (ii) named templates only; (iii) XPath-expression templates only; (iv) functions only. To select the required filter, click the dropdown arrow to the right of the Search box at bottom right of the window (screenshot below), and select the required filter (the second group of commands in the menu). The selected filter is applied immediately and applies from this moment onwards till it is modified or till XMLSpy is closed.
•Sorting and locating: Each column can be sorted alphabetically by clicking the column header. Each subsequent click reverses the previous sorting order. After a column has been sorted in this way, if you select any item in the list and then quickly type in a term from the sorted column, the first item in the list that contains that term will be highlighted. In this way, you can quickly go to templates of a particular name/expression, mode, or priority.
•Searching: Enter in the Search box (at bottom right) the name or XPath expression for which you wish to search. The search results are displayed as you type. The following search options are available in the dropdown list of the Search box (screenshot above): (i) whether the name or expression either starts with or contains the search term (the first group of commands in the menu); the starts-with option is the default each time XMLSpy is started; (ii) whether the search results should be displayed as a reduced list or be highlighted (the third group of commands in the menu); the reduced-list option is the default each time XMLSpy is opened. These selections are applied immediately and remain in effect till changed or till XMLSpy is closed.
•Reloading: After the stylesheet has been modified, click the Synchronize icon in the window's toolbar to update the XSL outline.
•Go to item: When a template or function is selected in the XSL Outline window, clicking the the Go to Definition icon in the window's toolbar highlights the template or function in the document in Design View. Alternatively, double-click an entry to go to it.
•Named template actions: Two groups of actions can be carried out involving named templates: (i) Calls to the named template (with xsl:call-template) can be inserted in the stylesheet at the cursor insertion point; and (ii) A named template can be set as the entry point for a transformation. The commands for these actions are carried out via icons in the toolbar and are described below.
Template mode for transformation
The combo box in the toolbar, called Set mode for transformation, lists (i) all the modes in the stylesheet, plus (ii) an empty entry (which selects the default mode) and, in the case of XSLT 3.0 stylesheets, (iii) the #unnamed mode. Selecting a mode from the dropdown list, sets the selected mode as the mode for the transformation. The #unnamed mode (for all XSLT versions) applies to all templates that have no mode attribute.
In the case of XSLT 1.0 and XSLT2.0 stylesheets, the default mode is the #unnamed mode. So selecting the empty entry selects the default mode (which is the #unnamed mode and which therefore applies to all templates with no mode attribute).
In XSLT 3.0 stylesheets, the top-level xslt element can have a default-mode attribute, which holds the default mode for the transformation. If, in the Set mode for transformation combo box, the empty entry (default mode) is selected, then the mode specified in the default-mode attribute will be used as the transformation mode. If #unnamed mode is selected in the combo box, then the transformation will be applied to all templates with an unnamed mode, that is, to templates with no mode attribute.
|Note:||A template can be given a mode value of #all to make it applicable to all modes.|
When a named template is selected, one or more commands in the window's toolbar relating to named templates become enabled (screenshot below).
The commands in the toolbar (screenshot above) are, from left to right:
•Insert xsl:call-template: This command becomes active when a named template is selected in the XSL Outline window. The command inserts an xsl:call-template element at the cursor insertion point in the stylesheet. The name attribute of the xsl:call-template element that is inserted in the stylesheet is given a value that is the value of the name attribute of the selected named template. This makes the xsl:call-template a call to the selected named template.
•Insert xsl:call-template with param: This command becomes active when a named template having one or more xsl:param child elements is selected in the XSL Outline window. As with the Insert xsl:call-template command, the command inserts an xsl:call-template element, but in this case with a corresponding xsl:with-param child element for every xsl:param child element of the selected named template. The names of the inserted xsl:call-template and its xsl:with-param child elements correspond to the names of the selected named template and its xsl:param children.
•Set the selected named template as entry point for transformation: When a named template is set as the entry point for a transformation, transformations executed in XMLSpy start at this named template. In the XSL Outline Window, such a named template is indicated in boldface (see screenshot at the start of this section).
•Clear named template as entry point for transformation: Becomes active once a named template has been set as the entry point for transformations.
•Jump to the named template selected as the entry point for transformations: Becomes active once a named template has been set as the entry point for transformations. When the focus in the XSL Outline window is at some other point than the named template set as the entry point for transformations, clicking this icon highlights the named template in the XSL Outline window, thus making access to it faster.