Registering XSLT report templates in custom plug-ins
Procedure
To register an XSLT template in an existing plug-in for templates:
- Create a basic Eclipse plug-in to contain the report template. Note: You can reuse an existing Eclipse plug-in or create a new one. You can include multiple XSLT templates in a single plug-in.
- In a text editor, open the plugin.xml file for the plug-in.
- Copy the templates that you want to register into any folder in the plug-in folder.
- Add the following XML code to the plugin.xml file to define the extension:
<extension point="com.ibm.ccl.erf.ui.services.IntegratingClient" point="com.ibm.xtools.publish.ui.xsltReportsextension" </extension>
- Add the following XML code to the extension to define a
client:
<extension point="com.ibm.ccl.erf.ui.services.IntegratingClient" <client class="com.ibm.xtools.publish.ui.internal.XSL_UML2XML_IntegratingClient" description="" display_name="" report_file_extensions="*.xslt;*.xsl" reporting_system="XSLT" uid="com.ibm.xtools.publish.uml2"> </client> point="com.ibm.xtools.publish.ui.xsltReportsextension" </extension>
Note: The description and display_name attributes are reserved for future use. - Within the client element, add XML code
to create a report_design_definitions and a resource_info element with the attributes shown in the following
code:
<extension point="com.ibm.ccl.erf.ui.services.IntegratingClient"> <client class="com.ibm.xtools.publish.ui.internal.XSL_UML2XML_IntegratingClient" description="" display_name="" report_file_extensions="*.xslt;*.xsl" reporting_system="XSLT" uid="com.ibm.xtools.publish.uml2"> <report_design_definitions> <resource_info categoryID="mycategoryID" description="%report1_description" display_name="%report1.name" path="<path to template>/<file>.xslt" type="FILE"> </resource_info> </report_design_definitions> </client> point="com.ibm.xtools.publish.ui.xsltReportsextension" </extension>
- The report description and display_name attributes are displayed in the Generate Report window and the Report Explorer view.
- The path attribute is the location of the report in the file system. It is convenient to locate the report in the plug-in where you define this extension point. In this case, the location is relative to the root folder of the plug-in; for example, /reports/myReport.xsl.
- The categoryID attribute is the category in which the report is displayed in the Report Explorer view. The category uml2.models category is the default value.
- You can define a new category by including the following code
after </client> tag:
If you use the default category definition, do not include a category definition.<category id="<category ID>" name="<category display name>" </category>
- If you need to support additional attributes that were
previously available in the reports.manifest file,
add them as properties under the resource_info node. You can supply the following properties for XSLT templates:
- oclSelfType="Class"
- oclQuery="self.oclIsKindOf(Class)"
- USING_ICONS="false"
- EXTRACTING_DIAGRAMS="false"
- DIAGRAM_FORMAT="JPG"
- DETAIL_LEVEL="FULL"
- Save the plugin.xml file.
- Specify plug-in dependencies in the manifest.mf file as follows:
- Open the manifest.mf file in a text editor
- In the Require-Bundle section, add
the following files if they are not already listed: com.ibm.ccl.erf.ui.services and com.ibm.xtools.publish.ui. The
section should look like the following example:
Require-Bundle: org.eclipse.core.runtime, com.ibm.ccl.erf.ui.services, com.ibm.xtools.publish.ui
- Save the manifest.mf file.
- Export the plug-in. Click Export > Plug-in development > Deployable plug-ins and fragments.
- Copy the .JAR file for the exported plug-in to the plugins directory of the Eclipse platform; for example, C:\Program Files\IBM\SDP753\plugins.
- Restart the Eclipse platform.
Results
You must ensure that the XSL file validates and can locate all the XSL files that it depends on.
Feedback