Working with XSL templates

When using content assist in the XSL editor, or when you are creating a new XSL file, you can insert predefined XSL code from a template file into your XSL file You might find it helpful to use templates if you want to reuse XSL code multiple times.

About this task

A set of templates is available to help you quickly develop XSL files. You can modify the templates to better meet your needs. You can also create new templates. To work with XSL templates:

Procedure

  1. Click Window > Preferences > XML > XSL > Editor > Templates. The Templates preference page opens.
  2. Edit an existing template, or create a new one:
    • To create a new template, click New.
    • To edit a template, click the template and then click Edit.
  3. In the Name field, type the name of the template, and type the description in the Description field.
  4. In the Context list, select the context in which the template is available in the content assist menu:
    • For a template that you can insert when creating a new XSL file, select New.
    • For a template that you can insert into an XSL file that you are editing, select Code.
  5. In the Pattern field, type the XSL content of your template. If you want to insert a variable, click Insert Variable and select the variable that you want to insert from the list. For example, to insert a variable for the current date, select date- Current date.
  6. To save your changes, click OK.

What to do next

You can use the templates when working with XSL files

Feedback