To increase the speed of runtime processing of XSL stylesheets,
you can precompile and integrate XSL 1.0 or 2.0 stylesheet documents
into Java projects.
Before you begin
- You must have a Java-enabled project into which you can output
the generated files.
- The project that contains the XSL stylesheet must include the
XML Transformations and Query project facet. To add the facet:
- Right-click the project and select .
- On the Project Facets page, select XML Transformations
and Query.
- If you see a message that other facets are required, select those
facets as well.
- Click OK.
About this task
The following instructions were written for the Resource
perspective, but they will also work in many other perspectives.
To
generate a compiled XSL file from an XSL file:
Procedure
- In the Project Explorer, right-click the XSL file.
- Click . The Compile XSLT wizard
starts.
- Set the XSLT compiler options for generating the compiled
XSL:
- Select the processor by choosing IBM Processor
for XSLT 1.0 or IBM Processor for XSLT 2.0 from
the list. If the target project for the compiled XSL output
does not support the processor that you selected, you can add support
by clicking Add processor support to target project.
- In the corresponding fields, enter the Class name, Package
name and Output container for the generated compiled XSL classes.
- To add the output folder to the .classpath file of a project,
select Include project container in project classspath, and then,
in the Target Project field, enter the path project.
- To add a utility Java class containing methods you can
use to invoke document transformation with the compiled XSL classes,
select Add Java Utility Class, and then in the corresponding fields,
enter the Source folder, Package and Name of the utility class.
Results
The compiled class and Java files are generated into the locations
that you specified in the wizard.