Creating XSL files

An XSL file is a style sheet that can be used to transform XML documents into other document types and to format the output.

Before you begin

About this task

Since the XML language does not use predefined tags, it is necessary to provide a Web browser with information on how to interpret the XML document. The XSL document provides a browser with information on how to display an XML document.

The following instructions were written for the Resource perspective, but they will also work in many other perspectives.

Procedure

  1. Create a project to contain the XSL file.
  2. In the workbench, click File > New > Other > XML > XSL and click Next.
    Tip: If you cannot see the XML option, select the Show All Wizards check box.
    The New XSL file wizard opens.
  3. Select the project or folder that will contain the XSL file.
  4. In the File name field, type the name of the XSL file (for example MyXSLFile.xsl) and then click Next. The name of your XSL file must end with the extension .xsl.
  5. On the Select XML file page, complete the following steps and then click Next:
    1. Under XSL Document Version, select the XSL version for the document.
    2. Under Root Element Names, select whether you want the root element of your XSL document to have <xsl: stylesheet> or <xsl: transform> as the root element for the document.
    3. Optionally, you can select an XML file to associate with your XSL file. For more information about associating XSL files with XML files, refer to the related task.
  6. Optionally, on the Select XSLT Template page you can choose to import an existing XSLT template. If you import an XSLT template, then your new XSL file is created using your default preferences for XSL version and root element names .
    Tip: Click the link to the XSLT Template preference page to create or modify the templates.
  7. Click Finish.

Results

The XSL file appears in the Navigator view and automatically opens in the XSL editor.

Feedback