APPLICATION DESIGN
You can also put XML on a page. A page in IBM® Lotus® Domino(TM) Designer is a database design element that displays information. You can use a page for traditional application content, such as a home page, or you can use XML tags to describe the data on a page. As you will see in the section on using XML in a view, a page is useful for embedding a view and adding the required XML tags to process the view. A page is also useful for creating an extensible stylesheet (XSL) or a cascading style sheet (CSS) to direct a server or browser on how to format data described with XML tags.
Defining data on a form with XML elements
When you use XML elements on a form or page, you must follow the rules for constructing valid XML and you must properly format the XML tags.
XML tags look very much like HTML tags. There are some different rules for structuring the XML tags that you must adhere to when marking up data. For example, requirements for nesting XML are more rigid than those for nesting HTML tags. For information on marking data with XML tags, visit the IBM XML Web site at http://www.ibm.com/xml
As an example of using XML on a form, the entries for each book in an online book catalog might look like this:
<?xml version="1.0" encoding="UTF-8"?>
<BOOK>
<bookTitle>Chess for the Master</bookTitle>
<bookCategory>Games</bookCategory>
<bookAuthor>Alice B. Charles</bookAuthor>
<bookPrice>10</bookPrice>
<bookListPrice>12</bookListPrice>
<bookISBN>0-980-38475-81</bookISBN>
<bookDatePublished>April 1997</bookDatePublished>
<bookAbstract>The authority on all the latest chess moves, including the entire Big Blue arsenal.</bookAbstract>
</BOOK>
Note XML tags are case-sensitive. The tags <book>, <Book> and <BOOK> are all different. Opening and closing tags must match case exactly for the XML to be well-formed.
To create documents in XML format
1. Create a new form or page.
2. Enter the document type declaration -- that is:
You can optionally add an encoding reference -- such as:
<?xml version="1.0" encoding="UTF-8" ?>
4. Enter the fields that will hold the data you are marking with XML.
5. Choose Design - Form Properties.
6. On the Form Info tab, choose "Render pass through HTML in Notes."
8. To view the documents created from the form, create a view that uses a form formula that resolves to the name of the XML form.
Formatting XML data with stylesheets
One of the attributes of XML is that it only describes data, and says nothing about the presentation of the data. The presentation is not important on computer-to-computer transactions -- it only matters if you are presenting the data to a user -- for example by posting it on a Web site. XML documents typically rely on a stylesheet to determine the layout and presentation of the data. Some browsers provide simple default styles for popular elements such as <Para>, <List>, and <Item>, but generally you must use a stylesheet to describe the data format. There are two types of stylesheets you can use with XML:
<?xml-stylesheet type="text/css" href="bookdisplay.css"?>
If you create a stylesheet on a page, set the page property to "Treat page contents as HTML."
An XSL stylesheet that transforms information on books to HTML might look something like this:
<?xml version="1.0" ?>
<xsl:template pattern="BOOK">
<HTML>
<HEAD>
<TITLE><xsl:value-of select="BOOKTITLE" /></TITLE>
</HEAD>
<BODY bgcolor="F0FFF8">
<B><xsl:value-of select="BOOKAUTHOR"/></B>
</BODY>
</HTML>
</xsl:template>
</xsl:stylesheet>
A cascading stylesheet (CSS), instead of transforming XML into HTML, provides instructions directly to the server regarding how to format each XML element. A CSS for books might look like this:
BOOK {
display: block;
border: 1px solid #cccccc;
}
BOOKTITLE {
float: left;
margin-right: 10px;
padding: 5px;
BOOKAUTHOR {
font-style: italic;
See Also