I Testing Templates with Template Viewer

This appendix describes how to use the Template Viewer tool.

This appendix includes the following sections:

About Template Viewer

Template Viewer is a BI Publisher desktop tool for testing templates.

You can download the BI Publisher desktop tools from the Oracle BI Enterprise Edition Home page or from the BI Publisher Home page. Use the Start menu to launch the Template Viewer installed on your Windows machine.

With Template Viewer desktop tool, you can:

  • Debug templates and sub-templates. See Debugging Templates.

  • Monitor memory used when a template is applied to a data file. See Monitoring Memory Usage.

  • Profile XSLT to view the time consumed by an XSL code. See Profiling XSLT.

  • Test the fonts used in a template. See Testing Fonts.

  • Test translation of a template by selecting the XLIFF file related to the template.

  • Export the output files to a selected location by using the Export option.

  • Run the XSLT processor to validate XML documents. See Validating XML Documents.

Debugging Templates

If you don’t see the expected results in the template preview window, you can use Template Viewer to enable trace settings and view the debug messages to solve the problem.

You can also save and view the intermediate XSL file generated after the sample data and template are merged in the XSL-FO processor. If you already use XSL, you’ll quickly learn the debugging features in Template Viewer.

To preview template with Template Viewer and view log messages:

  1. Open Template Viewer:

    From the Windows desktop, click Start, then Programs, then Oracle BI Publisher Desktop, then Template Viewer..

  2. Click Browse to locate the working directory that contains the sample data file and template file. The data file and template file must reside in the same folder.

  3. In the Files tab, select the appropriate option. For example, if you’re testing a .xsl template, select Excel Templates. The Data and Template regions display the data files and template files present in the directory

  4. Click the appropriate data and template files to select them.

  5. Select the log (debug) level.

  6. If you want to test a sub-template, browse and specify the sub-template in the Style Template File field.

  7. If required. set the report parameters in the Setting (Default) tab.

  8. From the Output Format list, select the output format. For example, Excel.

  9. Click Start Processing.

    The Template Viewer merges the selected data with the selected master template and sub-template and opens the appropriate viewer. View the log messages in the message box.

  10. To view the generated XSL:

    1. Select the data and template files and choose Excel output.

    2. Select Tools, then Generate XSL file from, then Excel Template.

    3. At the prompt, save the generated XSL file.

    4. Navigate to the saved location and open the XSL file in an appropriate viewer.

Monitoring Memory Usage

In Template Viewer, you can track the memory used when a template is applied to a data file.

To monitor the memory used by a template:
  1. Select the data file and template.
  2. Select the Monitor Memory Usage option.
  3. Select the output format from the Output Format list.
  4. Click Start Processing.
In the directory that you selected, Template Viewer generates a .csv file with a name that starts with MemMonLong. This log file stores information about the memory used before and after garbage collection. Memory is monitored in regular time intervals that are measured in seconds.

Profiling XSLT

You can use Template Viewer to profile XSLT. The XSL template includes time-logging commands that enable time measurements and act as a profiling tool. When you run a template, the log.csv file is generated to record the time for the running of the XSL code.

To profile XSLT in Template Viewer:
  1. Open Template Viewer.
    From the Windows desktop, click Start, then Programs, then Oracle BI Publisher Desktop, then Template Viewer.
  2. Browse and select the working directory.
  3. Select the XML data file and RTF template file to generate XSL.
  4. Select Tools, then Generate XSL file from, then Inject Profiling into XSL.
  5. Select RTF Template to generate XSL.
  6. Select Excel from the Output Format list.
  7. Click Start Processing.
  8. Open the file using Excel.
  9. Note the three areas that consume the most time.

Validating XML Documents

You can validate an XML document to ensure that it includes the proper code.

To validate an XML document by using an XSL template:
  1. Open Template Viewer.
    From the Windows desktop, click Start, then Programs, then Oracle BI Publisher Desktop, then Template Viewer.
  2. Browse and select the working directory.
  3. Select the XML data file.
  4. Select an XSL template for testing the XML document.
  5. Select Run XSLT from the Output Format list.

Testing Fonts

You can test fonts to ensure that your reports are displayed correctly.

You must ensure that the required fonts are mapped correctly, to avoid issues such as Roman alphabet characters not being displayed. You must ensure that the font family name in the font mapping exactly matches the name that is used in the template.
  1. Open Template Viewer.
    From the Windows desktop, click Start, then Programs, then Oracle BI Publisher Desktop, then Template Viewer.
  2. Navigate to the Setting (Default) tab.
  3. Load the xdo.cfg configuration file containing the font mapping.
    For example, the Arial font is set in the xdo.cfg file as follows:
        <font family="Arial" style="italic" weight="bold">
             <truetype path="D:\fonts\arialbi.ttf" />
         </font>
    
  4. Reload the xdo.cfg configuration file if you make any changes to it.
  5. Run the report.
    1. In the Files tab, select the data file and template for testing the fonts.
    2. From the Output Format list, select the output format.
    3. Click Start Processing
    4. View the report to verify if the fonts display correctly.