PhpStorm 2019.3 Help

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, install and enable the XPath View + XSLT plugin on the Plugins page as described in Installing plugins from repository.

Configure XSLT file associations

  1. Open the Settings/Preferences dialog Ctrl+Alt+S, and go to Languages and Frameworks | XSLT File Associations. 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 the Add button 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 the Remove button on the toolbar.

  2. To show associated XML files in the Project tool window, open the Settings/Preferences dialog Ctrl+Alt+S, go to Languages and Frameworks | XSLT, and select the Show Associated Files in Project View checkbox. after that, PhpStorm 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 File Associations | Add... from its context menu, and then select the X(HT)ML files to associate with the opened XSLT.

    Add Association
  • 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.

    Remove Association
  • 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.

Last modified: 9 December 2019