Thursday 18 August 2011

XML_Functionalitys _Tutorial


Welcome to Oracle XML Publisher
                Template Builder for Word 5.6.2!

Introduction

The Template Builder is an extension to Microsoft Word that simplifies the development of RTF templates. While the Template Builder is not required to create RTF templates, it provides many functions that will increase your productivity.

The Template Builder is tightly integrated with Microsoft Word and allows you to perform the following functions:

Ÿ  Insert data fields into your RTF templates
Ÿ  Insert data driven tables
Ÿ  Insert data driven forms
Ÿ  Insert data driven charts
Ÿ  Preview RTF templates with sample XML data
Ÿ  Browse and update the content of form fields
Ÿ  Extract boilerplate text into an XLIFF translation file and test translations

This help document assumes a basic working knowledge of Oracle XML Publisher. Please refer to the Oracle XML Publisher User’s Guide for additional information. This Template Builder version is based on XML Publisher 5.6.2.

If the template builder is installed correctly, you should see the menu bar shown below in the toolbar section:


If you are new to Template Builder for Word, please skip the next sections and continue with the Quick Tutorial.

What is new in Version 5.6.2?

Template Builder 5.6.2 provides the following new features:

Ÿ  XML Schema files (.xsd) as data definition
Ÿ  Drag & Drop for the Insert Field dialog
Ÿ  XML Publisher 5.6.2 compatible
Ÿ  Validation Function allows to check templates for problems.
Ÿ  Builder for simple XML Publisher Enterprise reports

Template Builder 5.6.2 allows you to load an XML Schema file (XSD) to describe the report data. The XML schema has the advantage of being complete (a sample xml may not contain all the fields from the data source). The Template Builder can generate dummy sample data for the preview from the XML Schema, but we still recommend that you upload a real sample XML.

What is new in Version 5.5?

Template Builder 5.5 provides the following new features:

Ÿ  Extract the template boilerplate into an industry standard XLIFF translation file
Ÿ  Preview templates with translation files
Ÿ  Sorting and page/section breaks for tables
Ÿ  XML Publisher 5.5 compatible

Quick Tutorial

This tutorial describes how you would typically create a simple layout template. You will create a letter that shows the outstanding balance for a customer. This letter contains a table of all unpaid or partially paid invoices.

Load Word File

Often a template starts from an example document in the form of a regular Microsoft Word document. For this tutorial go to the samples\RTF templates\Balance Letter folder under your XML Publisher installation directory (e.g. C:\Program Files\Oracle\XML Publisher Desktop) and load the file Balance Letter Start.rtf. This file represents a Word document that has not been marked up for use with Oracle XML Publisher.

Load Sample XML Data

From the Data menu select Load XML Data to load a sample XML document that contains the data fields you may want to insert into your RTF layout template. For this tutorial go to the samples\RTF templates\Balance Letter folder under your XML Publisher installation directory and load the file Balance.xml.

Insert Form Fields

You may want to select single data fields, such as the customer name and address at the header of the letter. Position the cursor in the Word document where you want to insert the Address. From the Insert menu select Field… to open the dialog window shown below.


Select the field Customer Name and click Insert to insert a form field for the customer name into the document. You may also insert the remaining address fields (such as Address Line1 to 4, City, State and Zip).

Starting with this version, you can also just drag the Customer Name field from the dialog and drop it into the Word document. NEW!

You can also select the fields, As of Date, Trx Currency Code and the C Inv Open Balance and insert them into the appropriate spaces in the document.

Note: As a beginner, you should use Insert Fields only for data fields that are unique (not repeating) in your document. Refer to the “Insert Table” section for additional information on how to insert repetitive fields

Preview Template

After adding fields to the document, you may want to test your template. Oracle XML Publisher Template Builder allows you to preview your template with your sample XML data. You can preview the output in Adobe Acrobat Reader (PDF), Microsoft Word file (RTF), Microsoft EXCEL (EXCEL) or a browser (HTML).

From the Preview menu select HTML to preview your template in a browser. From the Preview menu select PDF to preview your document in Acrobat Reader. You must have Adobe Acrobat Reader version 5.0 or higher installed to preview documents in PDF format. You can download Acrobat Reader for free at http://www.adobe.com/products/acrobat/readstep2.html.

The preview should show Vision Corporation instead of the field Customer Name.

Insert Table

You can build a table or a repeating section by inserting the elements and then adding additional form fields with processing instructions (for-each). Instead, the Template Builder offers an additional function that generates a table for you.

The Template Builder can generate for-each instructions either as descriptive or abbreviated. Abbreviated instructions are less invasive to the appearance of the document, while descriptive processing instructions make the template easier to understand. For this tutorial, select Options… from the Tools menu, switch to the Build tab and select Descriptive as shown below.


The document should include a table of all invoices that are not or only partially paid. On the Insert menu select Table/Form… to open the Table/Form Dialog. The following dialog will be displayed:


Scroll in the left Data Source view pane until you see the G Invoices element. Push the left mouse button and drag the G Invoices element over to the center Template tree view. When you drop an element with children (other elements below the element), the following pop-up dialog appears:


Note: A Node is a term used in tree views for an element in the tree view. For example, Customer Name, G Currency and G Invoices are all nodes. Transaction Date is also called a child node of G Invoices, and G Invoices is referred to as a parent node of Transaction Date.

To add multiple nodes, click Drop All Nodes with the left mouse button. When you select the "G Invoices" node, the dialog box should now look like this:


We only want to show the fields Trx Number, Transaction Date, Trans Amount, and Trans Amount Remaining. Select the field Trans Type in the center view and press the Delete button on your keyboard. Repeat the procedure for the other fields that you do not want to be included in the table (as shown in the screenshot below).

You should now click again on the G Invoices element in the center view. The Properties region on the right shows how the data fields will be formatted. You should see the following information:


For each group you can set the following properties that describe how a group (such as G Invoices) should be rendered by the template builder:

Style: Select Table to create a table around the data fields.

Grouping: Grouping is an advanced operation that allows you to re-group the data – for example by transaction date instead of currency. You can select the element that the data should be grouped by for this property. Please refer to the Oracle XML Publisher User’s Guide for additional information on grouping.

Show Grouping Value: This property will only be shown if you have selected a node created by the Grouping functionality. You can choose for a group if the Data Field node used as a grouping criterion is shown in the table or form.

Sort By: You can select an element by which the data groups are sorted.

Sort Order: If you have selected an element for Sort By you can select, if the data should be sorted either ascending or descending.

Sort Data Type: If you have selected an element for Sort By the data is by default sorted as Text. That means that 12 will be shown after 111. If you need to sort numbers you should select Number as the sort data type

Break: This property allows you to insert a page break or a section break between every data group. If nothing is select, then the data groups will be shown continuously with no break. If you select New Page per Element, then a page break will be inserted between each element. If you select New Section per Element, a section break will be created for each data group. A section break allows changing the header/footer and resets the page number. You will typically use this option, if you want to print multiple documents (for example invoices or purchase orders) to a single PDF file.


The order in which the data elements are shown reflects the order of the columns in the table. If you want to reorder the columns you need to change the Insert Position box from Child to Same Level. Then drag the elements into the correct order.

Click the OK button to create the table. The inserted table should look like this:

Trx Number
Transaction Date
Trans Amount
Trans Amount Remaining
for-each G_INVOICES TRX_NUMBER
TRANSACTION_DATE
TRANS_AMOUNT
TRANS_AMOUNT_REMAINING  end G_INVOICES

The Template Builder creates two kinds of form fields:

Ÿ  Form fields representing data elements
Ÿ  Form fields with processing instructions for repeating table rows or document section

Form fields representing data elements are replaced with the data when the template is processed. The for-each G_INVOICES and end G_INVOICES form fields indicate a repeating section. The section of the document encapsulated by these two form fields is repeated, if the associated data element G_INVOICE is found repetitively in the data. Please refer to the Oracle XML Publisher User’s Guide for additional information on form fields.

You can now format these elements in Microsoft Word and add additional text. You can also move fields around as long as you keep them in the surrounding for-each G_INVOICES and end G_INVOICES processing instruction. If you remove one of these processing instructions your template may not work anymore with XML Publisher.

You now can preview the template again to review your current template (see above). You probably would like to change the alignment of the table columns or change the data type and format for the amounts. For example, select the TRANS_AMOUNT field, right-click and select Properties to see the Text Form Field Options dialog.


You may select the Number in the Type field, #,##0.00 for Number format and enter 1000 as the Default Number to achieve a more desirable format for currencies in US Dollar. We recommend not to use currency signs such as $ in the format string, since it may lead to difficulties in supporting multiple languages with a single template.

Formatting options defined in this dialog box are understood by Oracle XML Publisher and used to format your fields. Try to modify the template to get an idea which Word functions are supported by XML Publisher 5.5.

Creating Charts

The data used for creating the open balance letter is not well suited to create a chart. Close the previous Word document and open a new Word document. Then load the RetailSales.xml file in the samples\RTF templates\Sales Report folder by selecting Load XML Data from the Data menu.

This data contains retail sales data for different industries. We will create a chart that shows the sales per industry. XML Publisher does not support native Microsoft Word Charts. You need to create charts using the Template Builder.

On the Insert menu select Chart… to open the Chart Dialog. The following dialog will be displayed:


On the left tree view pane you NEED to select the XML element that is repeated for each data element. Please make sure that the Row element is selected. We now select INDUSTRY for Grouping, because we want to see the data accumulated by industry. Then we select sum of Sales for the measure. We select a Pie Chart as the Type and click OK to insert the chart into the RTF template.


The Template Builder will insert the placeholder image shown below for the chart. To change the size of the chart, you can just resize the placeholder image.

chart:
<Graph graphType="PIE">
<Title text="" visible="true" horizontalAlignment="CENTER"/>
<LocalGridData rowCount="{count(xdoxslt:group(.//ROW,  'INDUSTRY'))}" colCount="1">
  <RowLabels>
<xsl:for-each-group select=".//ROW" group-by="INDUSTRY">
<xsl:sort select="INDUSTRY"/>
     <Label><xsl:value-of select="current-group()/INDUSTRY"/></Label>
</xsl:for-each-group>
  </RowLabels>
   <DataValues>
<xsl:for-each-group select=".//ROW" group-by="INDUSTRY">
<xsl:sort select="INDUSTRY"/>
     <RowData>
       <Cell><xsl:value-of select="sum(current-group()/SALES)"/></Cell>
     </RowData>
</xsl:for-each-group>   </DataValues>
  </LocalGridData>
</Graph>
From the Preview menu select HTML to preview your template in a browser. From the Preview menu select PDF to preview the output in Acrobat Reader.  The preview will show the correct chart for the preview data:


Please refer to the Oracle XML Publisher User’s Guide for additional information regarding charts.

Next Steps

This concludes the quick tutorial.  Try to create your own template now.  Refer to the help file for additional information. You should also consult section 2 “RTF Templates” of the Oracle XML Publisher User’s Guide packaged with the Template Builder. The User’s Guide is accessible from the Start menu under:

Programs → XML Publisher → Template Builder → XML Publisher User’s Guide

We hope you like the Template Builder and appreciate your feedback.

Your Oracle XML Publisher team

 Welcome to Oracle XML Publisher
                Template Builder for Word 5.6.2!

Introduction

The Template Builder is an extension to Microsoft Word that simplifies the development of RTF templates. While the Template Builder is not required to create RTF templates, it provides many functions that will increase your productivity.

The Template Builder is tightly integrated with Microsoft Word and allows you to perform the following functions:

Ÿ  Insert data fields into your RTF templates
Ÿ  Insert data driven tables
Ÿ  Insert data driven forms
Ÿ  Insert data driven charts
Ÿ  Preview RTF templates with sample XML data
Ÿ  Browse and update the content of form fields
Ÿ  Extract boilerplate text into an XLIFF translation file and test translations

This help document assumes a basic working knowledge of Oracle XML Publisher. Please refer to the Oracle XML Publisher User’s Guide for additional information. This Template Builder version is based on XML Publisher 5.6.2.

If the template builder is installed correctly, you should see the menu bar shown below in the toolbar section:


If you are new to Template Builder for Word, please skip the next sections and continue with the Quick Tutorial.

What is new in Version 5.6.2?

Template Builder 5.6.2 provides the following new features:

Ÿ  XML Schema files (.xsd) as data definition
Ÿ  Drag & Drop for the Insert Field dialog
Ÿ  XML Publisher 5.6.2 compatible
Ÿ  Validation Function allows to check templates for problems.
Ÿ  Builder for simple XML Publisher Enterprise reports

Template Builder 5.6.2 allows you to load an XML Schema file (XSD) to describe the report data. The XML schema has the advantage of being complete (a sample xml may not contain all the fields from the data source). The Template Builder can generate dummy sample data for the preview from the XML Schema, but we still recommend that you upload a real sample XML.

What is new in Version 5.5?

Template Builder 5.5 provides the following new features:

Ÿ  Extract the template boilerplate into an industry standard XLIFF translation file
Ÿ  Preview templates with translation files
Ÿ  Sorting and page/section breaks for tables
Ÿ  XML Publisher 5.5 compatible

Quick Tutorial

This tutorial describes how you would typically create a simple layout template. You will create a letter that shows the outstanding balance for a customer. This letter contains a table of all unpaid or partially paid invoices.

Load Word File

Often a template starts from an example document in the form of a regular Microsoft Word document. For this tutorial go to the samples\RTF templates\Balance Letter folder under your XML Publisher installation directory (e.g. C:\Program Files\Oracle\XML Publisher Desktop) and load the file Balance Letter Start.rtf. This file represents a Word document that has not been marked up for use with Oracle XML Publisher.

Load Sample XML Data

From the Data menu select Load XML Data to load a sample XML document that contains the data fields you may want to insert into your RTF layout template. For this tutorial go to the samples\RTF templates\Balance Letter folder under your XML Publisher installation directory and load the file Balance.xml.

Insert Form Fields

You may want to select single data fields, such as the customer name and address at the header of the letter. Position the cursor in the Word document where you want to insert the Address. From the Insert menu select Field… to open the dialog window shown below.


Select the field Customer Name and click Insert to insert a form field for the customer name into the document. You may also insert the remaining address fields (such as Address Line1 to 4, City, State and Zip).

Starting with this version, you can also just drag the Customer Name field from the dialog and drop it into the Word document. NEW!

You can also select the fields, As of Date, Trx Currency Code and the C Inv Open Balance and insert them into the appropriate spaces in the document.

Note: As a beginner, you should use Insert Fields only for data fields that are unique (not repeating) in your document. Refer to the “Insert Table” section for additional information on how to insert repetitive fields

Preview Template

After adding fields to the document, you may want to test your template. Oracle XML Publisher Template Builder allows you to preview your template with your sample XML data. You can preview the output in Adobe Acrobat Reader (PDF), Microsoft Word file (RTF), Microsoft EXCEL (EXCEL) or a browser (HTML).

From the Preview menu select HTML to preview your template in a browser. From the Preview menu select PDF to preview your document in Acrobat Reader. You must have Adobe Acrobat Reader version 5.0 or higher installed to preview documents in PDF format. You can download Acrobat Reader for free at http://www.adobe.com/products/acrobat/readstep2.html.

The preview should show Vision Corporation instead of the field Customer Name.

Insert Table

You can build a table or a repeating section by inserting the elements and then adding additional form fields with processing instructions (for-each). Instead, the Template Builder offers an additional function that generates a table for you.

The Template Builder can generate for-each instructions either as descriptive or abbreviated. Abbreviated instructions are less invasive to the appearance of the document, while descriptive processing instructions make the template easier to understand. For this tutorial, select Options… from the Tools menu, switch to the Build tab and select Descriptive as shown below.


The document should include a table of all invoices that are not or only partially paid. On the Insert menu select Table/Form… to open the Table/Form Dialog. The following dialog will be displayed:


Scroll in the left Data Source view pane until you see the G Invoices element. Push the left mouse button and drag the G Invoices element over to the center Template tree view. When you drop an element with children (other elements below the element), the following pop-up dialog appears:


Note: A Node is a term used in tree views for an element in the tree view. For example, Customer Name, G Currency and G Invoices are all nodes. Transaction Date is also called a child node of G Invoices, and G Invoices is referred to as a parent node of Transaction Date.

To add multiple nodes, click Drop All Nodes with the left mouse button. When you select the "G Invoices" node, the dialog box should now look like this:


We only want to show the fields Trx Number, Transaction Date, Trans Amount, and Trans Amount Remaining. Select the field Trans Type in the center view and press the Delete button on your keyboard. Repeat the procedure for the other fields that you do not want to be included in the table (as shown in the screenshot below).

You should now click again on the G Invoices element in the center view. The Properties region on the right shows how the data fields will be formatted. You should see the following information:


For each group you can set the following properties that describe how a group (such as G Invoices) should be rendered by the template builder:

Style: Select Table to create a table around the data fields.

Grouping: Grouping is an advanced operation that allows you to re-group the data – for example by transaction date instead of currency. You can select the element that the data should be grouped by for this property. Please refer to the Oracle XML Publisher User’s Guide for additional information on grouping.

Show Grouping Value: This property will only be shown if you have selected a node created by the Grouping functionality. You can choose for a group if the Data Field node used as a grouping criterion is shown in the table or form.

Sort By: You can select an element by which the data groups are sorted.

Sort Order: If you have selected an element for Sort By you can select, if the data should be sorted either ascending or descending.

Sort Data Type: If you have selected an element for Sort By the data is by default sorted as Text. That means that 12 will be shown after 111. If you need to sort numbers you should select Number as the sort data type

Break: This property allows you to insert a page break or a section break between every data group. If nothing is select, then the data groups will be shown continuously with no break. If you select New Page per Element, then a page break will be inserted between each element. If you select New Section per Element, a section break will be created for each data group. A section break allows changing the header/footer and resets the page number. You will typically use this option, if you want to print multiple documents (for example invoices or purchase orders) to a single PDF file.


The order in which the data elements are shown reflects the order of the columns in the table. If you want to reorder the columns you need to change the Insert Position box from Child to Same Level. Then drag the elements into the correct order.

Click the OK button to create the table. The inserted table should look like this:

Trx Number
Transaction Date
Trans Amount
Trans Amount Remaining
for-each G_INVOICES TRX_NUMBER
TRANSACTION_DATE
TRANS_AMOUNT
TRANS_AMOUNT_REMAINING  end G_INVOICES

The Template Builder creates two kinds of form fields:

Ÿ  Form fields representing data elements
Ÿ  Form fields with processing instructions for repeating table rows or document section

Form fields representing data elements are replaced with the data when the template is processed. The for-each G_INVOICES and end G_INVOICES form fields indicate a repeating section. The section of the document encapsulated by these two form fields is repeated, if the associated data element G_INVOICE is found repetitively in the data. Please refer to the Oracle XML Publisher User’s Guide for additional information on form fields.

You can now format these elements in Microsoft Word and add additional text. You can also move fields around as long as you keep them in the surrounding for-each G_INVOICES and end G_INVOICES processing instruction. If you remove one of these processing instructions your template may not work anymore with XML Publisher.

You now can preview the template again to review your current template (see above). You probably would like to change the alignment of the table columns or change the data type and format for the amounts. For example, select the TRANS_AMOUNT field, right-click and select Properties to see the Text Form Field Options dialog.


You may select the Number in the Type field, #,##0.00 for Number format and enter 1000 as the Default Number to achieve a more desirable format for currencies in US Dollar. We recommend not to use currency signs such as $ in the format string, since it may lead to difficulties in supporting multiple languages with a single template.

Formatting options defined in this dialog box are understood by Oracle XML Publisher and used to format your fields. Try to modify the template to get an idea which Word functions are supported by XML Publisher 5.5.

Creating Charts

The data used for creating the open balance letter is not well suited to create a chart. Close the previous Word document and open a new Word document. Then load the RetailSales.xml file in the samples\RTF templates\Sales Report folder by selecting Load XML Data from the Data menu.

This data contains retail sales data for different industries. We will create a chart that shows the sales per industry. XML Publisher does not support native Microsoft Word Charts. You need to create charts using the Template Builder.

On the Insert menu select Chart… to open the Chart Dialog. The following dialog will be displayed:


On the left tree view pane you NEED to select the XML element that is repeated for each data element. Please make sure that the Row element is selected. We now select INDUSTRY for Grouping, because we want to see the data accumulated by industry. Then we select sum of Sales for the measure. We select a Pie Chart as the Type and click OK to insert the chart into the RTF template.


The Template Builder will insert the placeholder image shown below for the chart. To change the size of the chart, you can just resize the placeholder image.

chart:
<Graph graphType="PIE">
<Title text="" visible="true" horizontalAlignment="CENTER"/>
<LocalGridData rowCount="{count(xdoxslt:group(.//ROW,  'INDUSTRY'))}" colCount="1">
  <RowLabels>
<xsl:for-each-group select=".//ROW" group-by="INDUSTRY">
<xsl:sort select="INDUSTRY"/>
     <Label><xsl:value-of select="current-group()/INDUSTRY"/></Label>
</xsl:for-each-group>
  </RowLabels>
   <DataValues>
<xsl:for-each-group select=".//ROW" group-by="INDUSTRY">
<xsl:sort select="INDUSTRY"/>
     <RowData>
       <Cell><xsl:value-of select="sum(current-group()/SALES)"/></Cell>
     </RowData>
</xsl:for-each-group>   </DataValues>
  </LocalGridData>
</Graph>
From the Preview menu select HTML to preview your template in a browser. From the Preview menu select PDF to preview the output in Acrobat Reader.  The preview will show the correct chart for the preview data:


Please refer to the Oracle XML Publisher User’s Guide for additional information regarding charts.

Next Steps

This concludes the quick tutorial.  Try to create your own template now.  Refer to the help file for additional information. You should also consult section 2 “RTF Templates” of the Oracle XML Publisher User’s Guide packaged with the Template Builder. The User’s Guide is accessible from the Start menu under:

Programs → XML Publisher → Template Builder → XML Publisher User’s Guide

We hope you like the Template Builder and appreciate your feedback.

Your Oracle XML Publisher team


No comments:

Post a Comment