Skip to main content
Windward

HTML Fragments In XML

Overview

AutoTag's HTML facilities are designed to enable fragments of HTML to be processed as subreports.  This guide explains how HTML fragments can be used as Windward Reports templates (styling commands and HTML content).

 

Details

There are two major use cases for HTML fragments: styling commands and importing HTML content.

 

  • HTML fragments can be used as styling commands. For example, you can import a <b> tag to make the text bold. 
  • One can also import HTML content, for example, from a rich text control on a web page. In this case, the HTML is meant to be richly formatted content using HTML markup. 

 

 

Inserting HTML Fragments

HTML fragments can be stored in the database as text, or as a link to a file containing the actual HTML data.  HTML fragments that are stored as text in a database can be inserted into a report with the Out Tag.  HTML fragments that are stored as a link to an HTML file can be inserted into a report with the Import Tag.  Whether you use the Out Tag or the Import Tag to insert HTML into the report, be sure to set the Type Attribute of the tag to "TEMPLATE".

Example: Inserting  HTML with the Out Tag.

The following XML data file has an HTML fragment stored in the <inline> tag.

<root>

<inline><![CDATA[<b>Hello, World!</b>]]></inline>

</root>

The HTML fragment can be inserted into the report using the following out tag:

<wr:out select="/root/inline" type="TEMPLATE"/>

The produced output will be:

Hello, World!

 

Example: Inserting HTML with the import tag.

Suppose you have the following XML data:

<root>

<file>//fragment.html</file>

</root>

You can insert fragment.html with the following template:

<wr:import select="/root/file" type="TEMPLATE"/>

The produced output will correspond to whatever is in the file fragment.html.

 

 

Formatting with HTML Fragments

The formatting effects of the imported HTML tags persist throughout the document.  For example, if the imported HTML contains only a formatting tag such as the <b> tag, then the character formatting will become bold.

Example: Using imported HTML to format the document.

Suppose you have the following XML data:

<root>

<boldOn><![CDATA[<b>]]></boldOn>

<boldOff><![CDATA[</b>]]></boldOff>

</root>

Now suppose you have the following in your template:

Not bold. <wr:out select="/root/boldOn" type="TEMPLATE"/>Bold. <wr:out select="/root/boldOff" type="TEMPLATE"/> Not bold.

The produced output will be:

Not bold. Bold. Not bold. 

Note: Older versions of Windward used type="HTML". If you do not see type="TEMPLATE", use type="HTML".

 

Limitations

Read about HTML Fragment Limitations at: HTML Input