Registering XSLT report templates in custom plug-ins

You can register XSLT report templates in a custom plug-in that you create, instead of in the standard plug-in.

Procedure

To register an XSLT template in an existing plug-in for templates:

  1. 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.
  2. In a text editor, open the plugin.xml file for the plug-in.
  3. Copy the templates that you want to register into any folder in the plug-in folder.
  4. 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>
  5. 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.
  6. 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:
      <category
         id="<category ID>"
         name="<category display name>"
      </category>
      If you use the default category definition, do not include a category definition.
  7. 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"
  8. Save the plugin.xml file.
  9. Specify plug-in dependencies in the manifest.mf file as follows:
    1. Open the manifest.mf file in a text editor
    2. 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
  10. Save the manifest.mf file.
  11. Export the plug-in. Click Export > Plug-in development > Deployable plug-ins and fragments.
  12. 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.
  13. 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