Skip to main content

Notice: This Wiki is now read only and edits are no longer possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

XSLT Project/UserGuide/Editor

Warning2.png
Draft Content
This page is currently under construction. Community members are encouraged to maintain the page, and make sure the information is accurate.


The XSL Tools plugins extend the ability of the Web Standard Tools XML editor. This extension adds specific support and functionality for working with and debugging XSL files.

Validation

The XSL extensions for the eclipse XML editor include as you type validation for XSL specific features. This includes not only the ability to syntax check the grammar, but to also to validate specific XSL specification rules. Grammar validation will be triggered based on the version attribute for the style sheet that is being edited. Valid version numbers are 1.0, and 2.0.

Content Assist

XSL Tools extends the existing content assistance support of the XML Editor to provide content assistance for several XSL namespace attributes. The content assistance provided covers the available XPath statements as defined in the XPath Templates preference page.

Important.png
XPath 2.0 Support
Currently XPath 2.0 is not supported directly. However, a user can add this support if they need it by adding the missing XPath functions to the XPath Templates.


To initiate content assistance press CTRL + SPACE or CMD + SPACE. This will bring up a dialog that will contain any proposals that are available. If no proposals are available an message will be displayed in the status bar.

XSLT Element Proposals

Since XSLT is a templating language, it's elements must be able to be added to the various markup it includes. The XSLT Editor will provide content assistance and proposals for XSLT elements that are available to be used within non-XSLT namespaced elements. This is depicted in XSLT Proposals within Non-XSLT elements.

XSLT Proposals within Non-XSLT elements

Select, Test, and Match Attributes

Where ever an xsl element supports a select, test, or match attribute, content assistance is available. This includes support for the following:

Select, Match and Test Assistance

  • Variables - both local and global variables are supported within the current stylesheet. Any local or global variable will be added to the list and the name is prefixed with a dollar sign $ symbol.
  • XPath 1.0- XPath 1.0 is supported through the use of templates. All of the XPath 1.0 and XSLT xpath extension functions are available, as well as axis operations. Currently XPath 2.0 is not supported directly, but will be added in the future.

Content assistance for the select and test attributes is intelligent enough to know that it is within an XPath expression, and will try to determine and provide content assistance based on the current cursor position. If a word has been partially typed it will filter the available assistance.

Exclude-Result-Prefixes

The exclude-result-prefixes attribute in both XSLT 1.0 and XSLT 2.0 allows for the exclusion of certain namespace declarations in the output document. The content assistance populates a list of available namespaces that have been defined in the stylseheet and provides them as proposals as shown in Exclude-result-prefixes Content Assistance.

Exclude-result-prefixes Content Assistance

If the attribute has no values defined, then the #all value will be available in the list. If #all is already in the attributes value, then no content assistance will be available.

Filtered exclude-result-prefixes proposals

Content assistance is intelligent enough to know when a namespace prefix is already in the list of excluded namespaces. In this case it will not show the namespace in the proposal list.

Note.png
Why isn't the XSL Namespace prefix in the proposals?
Currently the xsl prefix or any prefix that uses the XSL namespace is excluded from the list. This may be changed at a future date. This will depend on user feedback.


Mode attribute assistance

Content assistance is available for those xsl elements that support the mode attribute. For XSLT 1.0 these elements are template apply-templates and apply-imports.

Mode attribute assistance

The proposal list is populated by those modes defined on templates in the current stylesheet, and any of the templates that are included or imported.

Named Template Assistance

Call Named templates have content assistance available for their name attributes. This will provide a list of called-templates that have been used, but have not yet been defined or overridden within the current stylesheet.

Named Template Assistance

Call-Template Assistance

Any call-template xslt element has content assistance available for it's name attribute. This will provide a list of possible XSLT named templates that can be called from the current stylesheet. This takes into effect all included and imported stylesheets as well as those defined in the current stylesheet.

Call-Template Assistance

Include and Import href Assistance

XSLT stylesheets have the ability to import and include other stylesheets. This allows for a modular structure for the templates to be created. It also allows for easier maintenance. However, if one is working with a large project like the DocBook Projects stylesheets it can be difficult to remember the names and locations of all the stylesheets. To this end, the XSLT editor provides content assistance for the href attribute. The scope of the assistance is restricted to the project that the current stylesheet that is being editted resides.

Include/Import href Assistance

Templates

Specific XSL code completion templates can be added to the XML editor's Templates. This allows a user to define specific markup completion templates that are commonly used. In addition, the XPath Templates page can be enhanced to allow commonly used XPath templates to be included, in addition to those installed by default. This allows a user the ability to add custom extension functions for XSLT that may be processor specific. Adopters may also use the standard template extension point to add additional functionality.

XPath Templates

The XSL XPath Templates preference page allows for a user or adopter to add specific xpath extensions so that they show up in the content assistance. See the XPath Templates documentation for more information.

XSLT Syntax Coloring

XSL Tools Editor can have syntax coloring that is specific just for the the XSLT Namespace as showing in XSLT Specific Syntax Coloring .

XSLT Specific Syntax Coloring

The default coloring shown is to make all XSLT elements and attributes bold. The settings are controled in XSLPreferences .

XSLT Markers and Annotations

The XSL editor supports the ability to annotate or provide markers. These annotations provide additional information about the templates and XSLT elements in the stylesheet.

Template Override

The XSLT editor will mark templates that have overriden an imported template of the same name.

Overriden Template

In Overriden Template the template TempB overrides an imported template. By moving the mouse pointer over the triangle icon in the rule bar, information about which file the original template resides.

Overriden Template Information

XSL Debugging

The XSL Editor supports the ability to specify break points within an XSL File. If the file is included or imported and the break point is encountered during a transformation scenario it will be respected. A break point may be set at any valid XSL element or other xml element within the XSLT stylesheet. See the Launching and Debugging section for more information on debugging XSLT stylesheets.

Navigation

Many of the variables, imports/includes, and templates can be navigated to using the Open Declaration (F3) popup menu option. They can also be navigated to directly by CTRL-Clicking on the name of the variable, import/include, or template. Items that currently have hyperlinking navigation are:

  • Called-Templates
  • hrefs for Import and Includes
  • With-Param variables
Note.png
Navigation to a Named Template in an included/imported stylsheet
The hyperlinking ability will navigate you to where ever the first definition of the template is defined. So if the template is defined within the current stylesheet it will navigate to that definition. However if it is defined in an imported or included stylesheet, or any of those imported or included stylesheets it will take you to that definition. Use the standard navigation errors to move back and forth during this hyperlinking.

Back to the top