MicroStrategy ONE

Overview of HTML Generation

MicroStrategy Web products use several different methods to generate HTML output, depending on the location from which the HTML output is generated and the underlying technology used to generate the output. These methods fall into four general categories:

  • Generating HTML output by passing HTML tags through as text

    Normal HTML tags in external text files, such as XML layout definition files, and JSP/ASP.NET files are passed through to the browser as simple text, without being processed or modified. The XML in layout definition files is validated, but it is not modified. Generating HTML output using an XML layout definition file relies on MicroStrategy technology, and generating HTML output using a JSP/ASP.NET file relies on the underlying JSP/ASP.NET technology.  

  • Generating HTML output programmatically

    The Tag Infrastructure includes specialized MicroStrategy-specific tag interfaces, which can be used to build HTML output programmatically in Java transform classes. These interfaces provide helper methods that simplify the generation of a number of common HTML tags. This method of HTML output generation relies on MicroStrategy technology.  

Two of these methods rely heavily on MicroStrategy's Tag Infrastructure— generating HTML output parametrically and programmatically. The Tag Infrastructure includes a generic Tag interface, together with a set of specialized tag interfaces that derive from the generic interface. The TagsFactory class creates instances of all tag objects. The EnumHTMLTags enumeration defines constants for the most common HTML elements, attributes, and attribute values.

The Tag interface represents a generic HTML element, from which any element can be instantiated. The specialized tag interfaces define two distinctly different types of elements - a set of commonly-used static HTML elements and a set of MicroStrategy-specific elements used to create HTML output dynamically.

A frequently-customized static HTML element is the anchor tag, which is used to generate links in the application. To standardize the construction of links and provide support for any Web platform, MicroStrategy Web uses a ParameterBuilder infrastructure. The ParameterBuilder interface and the classes derived from it contain methods to create the serialized string of information that is used to construct a URL or hidden inputs for a form.

The remaining topics in this book provide more detailed descriptions of the Tag Infrastructure and its specialized static and dynamic tag interfaces, the Parameter Builder Infrastructure, and Custom HTML tags. The sections below describe in more detail each of the four methods used to generate HTML output in MicroStrategy Web products.

Generating HTML output by passing HTML tags through as text

When MicroStrategy Web parses XHTML code that it finds in its layout definition files, and JSP/ASP.NET files, it passes regular elements through to the HTML output without modification. MicroStrategy Web relies on the underlying JSP or ASP.NET technology to handle these elements. Because these elements are not dependent upon any contextual information, they are passed through by the XML parser, exactly as they appear in the source XHTML, causing an identical tag to be created in the HTML output.

Generating HTML output parametrically

You can dynamically modify the HTML output generated programmatically in a Java transform class, by using  MicroStrategy-specific dynamic tags in the XML layout definition file associated with the transform in the Style Catalog Configuration file. The Tag Infrastructure includes specialized MicroStrategy-specific dynamic tag interfaces that let you apply logic, iterate through lists (including forcing the application to move to the next object in a list), pass arguments, and add attributes dynamically, when the HTML output is being rendered.

The Tag infrastructure provides the following specialized  MicroStrategy-specific dynamic tag interfaces:

  • Layout tag

    This tag identifies a layout definition file. It does not cause a tag to be created in the HTML output.  

  • Attribute tag

    This tag creates an attribute in its parent element. It does not cause a new tag to be created in the HTML output, but it does modify an existing tag in the HTML output.  

  • If..then..else tag

    These tags allow you to insert logic within a static HTML tag to determine the output dynamically. They do not cause a distinct tag to be created in the HTML output, but they do influence the creation of the tag with which they are associated.  

  • List tag

    This tag creates a list of objects that can be iterated through to form a repeating structure. It does not cause a distinct tag to be created in the HTML output, but it does affect the creation of the tag with which it is associated.  

  • Next tag

    This tag forces the application to move to the next object in a list of object. It does not cause a distinct tag to be created in the HTML output, but it does affect the creation of the tag with which it is associated.  

  • Render tag

    This tag renders a piece of HTML at the point of the render instruction. It does cause a tag to be created in the HTML output.

  • Argument tag

    This tag is used to pass an argument to one of the following tags— the attribute tag, if tag, list tag or render tag. In each case, the value of the argument passed to the tag represents the value of the argument passed to the method that corresponds to the tag.

Dynamic HTML tags are used exclusively with XML layout definition files, and the tag names are always  preceded with mstrlayout: (used for namespacing). The code sample below, which simply renders content, illustrates this format:

Copy
<div class="description">
   <mstrlayout:rendername="FolderDescription" />
</div>

For more information about layout definition files, see Layout Definitions.

Generating HTML output using MicroStrategy custom tags

MicroStrategy Web products also let you generate dynamic HTML output in JSP or ASP.NET files using MicroStrategy custom tags. In format, custom tags are similar to the MicroStrategy-specific dynamic tags that are part of the Tag infrastructure.

  • MicroStrategy-specific dynamic tag names are prefixed with mstrlayout:  

  • MicroStrategy custom tag names are prefixed with web:

However, the location from which the HTML output is generated and the underlying technology used to generate the output are quite different for the two methods.

  • MicroStrategy-specific dynamic tags are used to generate HTML output programmatically in Java files and rely on MicroStrategy technology.  

  • MicroStrategy custom tags are used in JSP or ASP. NET files and rely on proprietary technology from Sun Microsystems and Microsoft to generate the HTML output— Custom Tag technology for JSP files and Custom Web Control technology for ASP.NET files.

Generating HTML output programmatically

You can create HTML output programmatically in Java transform classes, using the MicroStrategy Tag Infrastructure. To accomplish this, you use either the generic Tag interface or the specialized static HTML tag interfaces. These specialized interfaces contain special helper methods for generating the following common HTML elements:

  • Anchor tag  [<a>]  

  • Image tag  [<img>]  

  • Input tag  [<input>]  

  • Select tag  [<select>]  

  • Table tag[<table>]

    • Row tag  [<tr>]  

      • Cell tag  [<td>]

See also: