Skip to main content

By clicking Submit, you agree to the developerWorks terms of use.

The first time you sign into developerWorks, a profile is created for you. Select information in your developerWorks profile is displayed to the public, but you may edit the information at any time. Your first name, last name (unless you choose to hide them), and display name will accompany the content that you post.

All information submitted is secure.

  • Close [x]

The first time you sign in to developerWorks, a profile is created for you, so you need to choose a display name. Your display name accompanies the content you post on developerworks.

Please choose a display name between 3-31 characters. Your display name must be unique in the developerWorks community and should not be your email address for privacy reasons.

By clicking Submit, you agree to the developerWorks terms of use.

All information submitted is secure.

  • Close [x]

Using XML data islands in Domino Designer

Susanna Doyle, User Assistance Architect, Lotus
Susanna is a User Assistance Architect in the Domino and Notes User Assistance group. She has worked in technical communication for 15 years, ten of them at Lotus. Moving to the Notes UA group during Release 3, she contributed to several areas of both online and printed documentation, eventually concentrating on the user interface and database design for online Help, which has been her responsibility since Release 4. She received her B.A. in writing from the University of Pennsylvania, and spends her spare time singing, playing guitar, and dancing the Lindy Hop.

Summary:  Using XML data islands, a feature in Internet Explorer, you can keep most of the existing design of a Domino Web application and use a little JavaScript to fetch a small amount of XML data, apply XSL, and display the island when the document is loaded.

Date:  01 May 2000
Level:  Intermediate
Also available in:   Japanese

Activity:  3583 views
Comments:  

There is continued interest in using XML (Extensible Markup Language) when developing applications, and with good reason. XML has become the de facto standard for data interchange, freeing developers from the more mundane issues related to data interchange so they can focus on the data itself and how it will be represented.

As you may know from reading the Iris Today article, "Exercising XML with Domino Designer," you can mark up Notes forms and views using XML and display the XML to an XML-compatible browser the same way you would include HTML markup in a Notes database. You can use XSL to filter and style the XML data, or you can use a cascading style sheet (CSS) if you only want to use styles without any filtering.

But suppose you want to keep most of the Domino database design you already have, which Domino automatically serves to browsers as HTML, and include only a small amount of XML data within the HTML in your documents. To do this, you can use an XML data island in a Notes document. A data island is a piece of XML within an HTML page. You can use a little JavaScript to fetch the island, apply XSL, and display the island when the document is loaded.

This article describes the JavaScript you currently need to display an XML data island within a document using XSL in Microsoft Internet Explorer 5, while hiding the code from non-XML compatible browsers. (As browser handling of XML improves, more ways to do this using combinations of JavaScript and XML/XSL may evolve, and you might then be able to change your display formula to hide the XML from fewer browsers.) For general information about XML and XSL (Extensible Stylesheet Language), see the World Wide Web Consortium (W3C) XML page.

You can also download the Domino 5 Designer Help (with XML) example database from the Notes.net Doc Library to see the design elements discussed in this article.

Where to place the island

You can place a data island either on the background of a Notes form or within a rich text field in any document. If the XML is on the background of a form, you can use field data as part of the XML and show the information in many documents, but the XML must appear either before or after any rich text fields (such as the Body field) on the form. If you put an XML data island within a rich text field, you must repeat the XML data in all documents where you want it to appear. Additionally, you can't use field data within a rich text field.


Using an island on a form

Here is an example that uses XML to add a table of context information to @function topics in Domino 5 Designer Help. We've placed the XML on the topic form using a computed subform, but you could also place the XML directly on the form and use a hide-when formula to hide the XML from non-XML compatible browsers.


Figure 1. Context table in Designer Help topic
Context table in Designer Help topic

The XML data for the table actually consists only of yes/no answers for various contexts in which an @function may be used. XSL creates the table, styles the fonts, adds the label text (for example, SmartIcon:), and even performs conditional filtering to show any "no" answer in red. You could, instead, use a cascading style sheet to assign the HTML tags and style the table, but only XSL can filter the data conditionally.


The XML data island

The data island is a set of XML tags wrapped in an overall <XML> element, with an ID to be used by JavaScript (our ID is "thisXML"). In this example, the island is on a subform and all its text is set as PassThru HTML. The fields to hold the XML data are wrapped in the XML start and end tags.


Figure 2. Data island
Data island

Your XML island can be as long or short as you want. It takes the basic form:

<XML ID="yourXML">	
<yourdata>some data</yourdata>
</XML>


The JavaScript

The JavaScript follows immediately after the data island and is also set as PassThru HTML. It displays the XML on the onLoad event for the document, using XSL, which is stored as a page element in the same database. The reference to the XSL page is relative, that is, "../yourstylesheet.xsl." This is the JavaScript that references the "functiontable.xsl" page and the "thisXML" island. We've placed the resulting HTML inside a <DIV> tag, but you could put it into any similar tag.

<XML id="style" src="../functiontable.xsl"></XML>
<SCRIPT FOR="window" EVENT="onLoad">

	xslTarget.innerHTML = thisXML.transformNode(style.XMLDocument);

</SCRIPT>

<DIV id="xslTarget"></DIV>


The XSL page

The XSL page can have any name but must end in .xsl. It must also be set in Page Properties to "Treat page contents as HTML."

This XSL is much like the XSL for the table in the article, "Exercising XML with Domino Designer." However, it also uses xsl:choose statements to test the data and display it conditionally. This xsl:choose statement works in Internet Explorer 5, but may not be legal in XSL served-based transforms.

To see the code for the XSL page, go to the XSL page sidebar.


Using an island within a document

To use an island like this example in the midst of a document, simply place the XML island followed by the JavaScript, anywhere within a rich text field and set the tags as PassThru HTML. Enter the actual data for each tag as text instead of using a field between the start and end tags.


Hiding an island from non-XML compatible browsers

When a browser that doesn't handle XML sees this island, it simply streams the text from the unknown tags into the middle of the HTML, ignoring the XSL formatting. This raw HTML isn't something you want to display to users.

Fortunately, you can use the R5 @BrowserInfo function to detect inappropriate browsers and hide the XML. We used this formula for the computed subform (called "island") that holds the data island.

@If(@BrowserInfo("BrowserType")="Microsoft" & @BrowserInfo("Version")=5 & TopicType="function";"island";"")

In addition to showing the XML only to Microsoft Internet Explorer 5, the formula shows the XML only on documents where the TopicType field contains "function". Otherwise the island would appear in all documents that use the form, regardless of whether those documents had actual data for the fields that the XML uses. In the example, the default value of the fields would be used and everything in the table would display as "yes."

Finally, remember to set all the XML text to hide from the Notes client.


Resources

About the author

Susanna is a User Assistance Architect in the Domino and Notes User Assistance group. She has worked in technical communication for 15 years, ten of them at Lotus. Moving to the Notes UA group during Release 3, she contributed to several areas of both online and printed documentation, eventually concentrating on the user interface and database design for online Help, which has been her responsibility since Release 4. She received her B.A. in writing from the University of Pennsylvania, and spends her spare time singing, playing guitar, and dancing the Lindy Hop.

Report abuse help

Report abuse

Thank you. This entry has been flagged for moderator attention.


Report abuse help

Report abuse

Report abuse submission failed. Please try again later.


developerWorks: Sign in


Need an IBM ID?
Forgot your IBM ID?


Forgot your password?
Change your password

By clicking Submit, you agree to the developerWorks terms of use.

 


The first time you sign into developerWorks, a profile is created for you. Select information in your developerWorks profile is displayed to the public, but you may edit the information at any time. Your first name, last name (unless you choose to hide them), and display name will accompany the content that you post.

Choose your display name

The first time you sign in to developerWorks, a profile is created for you, so you need to choose a display name. Your display name accompanies the content you post on developerWorks.

Please choose a display name between 3-31 characters. Your display name must be unique in the developerWorks community and should not be your email address for privacy reasons.

(Must be between 3 – 31 characters.)

By clicking Submit, you agree to the developerWorks terms of use.

 


Rate this article

Comments

Help: Update or add to My dW interests

What's this?

This little timesaver lets you update your My developerWorks profile with just one click! The general subject of this content (AIX and UNIX, Information Management, Lotus, Rational, Tivoli, WebSphere, Java, Linux, Open source, SOA and Web services, Web development, or XML) will be added to the interests section of your profile, if it's not there already. You only need to be logged in to My developerWorks.

And what's the point of adding your interests to your profile? That's how you find other users with the same interests as yours, and see what they're reading and contributing to the community. Your interests also help us recommend relevant developerWorks content to you.

View your My developerWorks profile

Return from help

Help: Remove from My dW interests

What's this?

Removing this interest does not alter your profile, but rather removes this piece of content from a list of all content for which you've indicated interest. In a future enhancement to My developerWorks, you'll be able to see a record of that content.

View your My developerWorks profile

Return from help

static.content.url=http://www.ibm.com/developerworks/js/artrating/
SITE_ID=1
Zone=Lotus
ArticleID=12607
ArticleTitle=Using XML data islands in Domino Designer
publish-date=05012000
author1-email=
author1-email-cc=

Tags

Help
Use the search field to find all types of content in My developerWorks with that tag.

Use the slider bar to see more or fewer tags.

For articles in technology zones (such as Java technology, Linux, Open source, XML), Popular tags shows the top tags for all technology zones. For articles in product zones (such as Info Mgmt, Rational, WebSphere), Popular tags shows the top tags for just that product zone.

For articles in technology zones (such as Java technology, Linux, Open source, XML), My tags shows your tags for all technology zones. For articles in product zones (such as Info Mgmt, Rational, WebSphere), My tags shows your tags for just that product zone.

Use the search field to find all types of content in My developerWorks with that tag. Popular tags shows the top tags for this particular content zone (for example, Java technology, Linux, WebSphere). My tags shows your tags for this particular content zone (for example, Java technology, Linux, WebSphere).

Try IBM PureSystems. No charge.

Special offers