XSLT file associations
File Associations are used to associate an XSLT file with other XML files. This is currently used for three purposes:
Enhanced completion for element- and attribute names in XSLT node-selections. The completion will offer all element- and tag names that are found in the associated documents.
Enhanced error highlighting for XSLT node-selections. If an XSLT script has been associated with one or more XML files, any references to element- and attribute names that are not part of the associated files fill be flagged with the warning message: "Tag name '...' is not part of the document".
File Associations are also used for creating Run Configurations. The XML input file to use for the transformation can be conveniently chosen from the list of associated files.
XSLT File Associations are defined per project and managed on the XSLT File Associations page of the Settings dialog.
Before you start, make sure the XPath View + XSLT plugin is enabled on the Settings/Preferences | Plugins page, tab Installed, see Managing plugins for details.
Configure XSLT file associations
Open the Settings/Preferences dialog Ctrl+Alt+S, and go to . The XSLT File Associations page opens.
The page consists of two panes:
The Project XSLT Files panes shows all the XSLT files in a project tree view, grouped by modules and their content roots.
The Associated Files pane shows all the XML file associated with the selected XSLT file. To add a new file to an association, select the relevant XSLT file, click on the toolbar, and then select the XML file to add in the dialog that opens.
To cancel an association, select the XML and click on the toolbar.
To show associated XML files in the Project tool window, open the Settings/Preferences dialog Ctrl+Alt+S, go to , and select the Show Associated Files in Project View checkbox. after that, WebStorm will show associated XML files below the corresponding Style Sheets.
Manage associations from the editor
To create an association, open an XSLT file in the editor, select
from its context menu, and then select the X(HT)ML files to associate with the opened XSLT.To cancel association for a file, click its filename in the File Associations group. The file names are displayed with a path that is relative from the current file. If the associated file is part of any module, the module name is included in square brackets.
You can also invoke the associations configuration dialog through the Configure... action. This opens the associations configuration dialog and preselects the file that's currently opened in the editor.