Search DominoPower's 11,425 Lotus-related article archive 
Home
EasyPrint
News details Click here for the RSS feed's XML code. This is not a browser URL.
Articles-only Click here for the RSS feed's XML code. This is not a browser URL.
Twitter Feed Click here for the Twitter feed.
Parsing XML with LotusScript and Microsoft's XML object (continued)

The second XMLStyleSheet agent
XSL style sheets are really a subject by themselves but, as always, you can start with something simple. A good starting point is using HTML elements with XSL statements to select fields from a source XML document. An analogy would be a mail merge.

For this agent, I created a new TableTest document to hold the style sheet and used it against the XML field in my News document which was populated when I ran the XMLHeadlines agent above. Using existing XML data from this field allowed me to try out the loadXML function which loads a string rather than a file. With the XML and style sheet data loaded into two separate objects, it was a simple matter of calling transformNode() and putting the returned string of HTML in a new document. Below is the style sheet I used in the agent.

<?xml version='1.0'?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/TR/WD-xsl";>
<xsl:template match="/">
<HTML>
<BODY>
<TABLE BORDER="2">
<TR>
<TD><H3><xsl:value-of select="rdf:RDF/channel/title"/></H3></TD>
</TR>
<xsl:for-each select="rdf:RDF/item">
<TR>
<TD><xsl:value-of select="title"/></TD>
</TR>
</xsl:for-each>
</TABLE>
</BODY>
</HTML>
</xsl:template>
</xsl:stylesheet>

The "template match" line says to start at the root of the XML document. The "value-of select" statement picks up a particular field value as in the first agent (in this case, the title of the channel). The "for-each" statement repeats a block of HTML for each matching element (in this case, each item). Within the block I get the particular title value. The following is a partial output:

<HTML>
<BODY>
<TABLE BORDER="2">
<TR>
<TD><H3>DominoPower News Center</H3></TD>
</TR>
<TR>
<TD>Battle against piracy</TD>
</TR>
<TR>
<TD>SmartSuite review</TD>
</TR>

The beauty of this approach is that you can use the same agent with different style sheets, depending on what you want as output, a bit like using sub-forms in a form. The style sheets can be very complex and perform selection, ordering, pattern matching, and can have embedded JavaScript in as well. Hopefully this little example will whet your appetite for further experimentation as it did mine.

Product availability and resources
Internet Explorer 5 is freely available from http://www.microsoft.com.

The example agents database was created using Domino 4.63 and is at http://www.electricmemo.com/articler.nsf.

You can also download the sample database from ftp://ftp.dominopower.com/dominopower/outgoing/issues/dp0899-xml.zip. It is not normally our practice at DominoPower to provide download samples. However, at the request of the author, we have posted this file. If you have problems using this file, please contact the author directly or post a message on the PowerBoards. The editorial staff at DominoPower is not able to provide technical support.

The MSXML on-line resources are at http://msdn.microsoft.com/xml/reference/scriptref/XMLDOM_Objects.asp.

For reference material, check out XML in Action by William J. Pardi ISBN 0-7356-0562-9.

For a list of published channels download My.UserLand's service list from http://my.userland.com/xml/servicelist.xml. If you're using Internet Explorer 5, you'll be able to directly see the XML code when clicking on this link. Other browsers may attempt to download this list as a file.

For a general list of who's publishing XML content try XMLTree visit http://www.xmltree.com.

Mark Lawson is a freelance Notes consultant in the UK. He can be reached at markl@electricmemo.com.


« Previous  ·  1  ·  2  ·  3
Other articles you might like
Home > Internet Technologies > XML (11 articles)
   How to create a Web service to extract data from XML documents
   Building an XML based Content Management System using Lotus Domino: wrapping it up
   Building an XML based Content Management System using Lotus Domino: overview of the content administration system
Home > Microsoft Technologies (30 articles)
   Making Domino work with IIS
   Preparing for the impending IE7 release
   How to create animated, context sensitive help for the Notes client
Home > Internet Technologies > RSS and blogging (11 articles)
   Integrating AJAX and RSS into Domino applications
   Introducing the DominoPower RSS feeds
   Bridging the communications gap with RSS
Get Weekly Email Updates
Subscribe to our regular weekly email newsletter. It's packed with tips, reviews, deep analysis, and the latest news.
 
Recent DominoPower Articles
Application development, William Shatner, and the origin of the universe
Learn Domino Designer 8.5 for free
The (near) future of Sametime, Quickr, Connections, and Symphony
Inside the IBM Innovations lab
Lotusphere 2010: Hot fixes and cool news for Notes, Domino, and LotusLive
Lotusphere 2010: mobility and collaboration
2010: A Lotusphere of change
Latest Lotus Headlines
Quickr place Superusers
Writing Client-Side Javascript for Re-Use
Lotus Notes R8.5.1: Bug in Contacts "Print Selected View"
New Notes/Domino Technotes published about Chile's extended daylight saving time
SnnT: How to prevent Google from listing your Sametime Server
How to send someone an email that shows your calendar availability
"The collection has become invalid"
>> Read all the news
More from the ZATZ journals
Computing Unplugged: The iPad defenders have spoken
David Gewirtz Online: CNN commentary and analysis
OutlookPower: More about disappearing text
-- Advertisement --

Sophisticated Meets Simple For Document Management
Share. Control. Manage.
Documents, emails, and content in the context of how work is done. Native to Lotus Domino. The User Experience unseen for Lotus Domino. Do more with less. Really.

See the possibilities Docova unleashes for Lotus Domino.
-- Advertisement --

Mark your calendar for in-depth Lotus training, May 12-14, Boston
Join experts and peers May 12-14 in Boston for educational and networking events that deliver real-world Lotus training so you can increase productivity and efficiency in your company, advance your skills, and squeeze the most from your current environment. One registration gets you into THE VIEW's Admin2010 and Lotus Developer2010.

Register by April 10 to save $200.
ZATZ Home  ·  News  ·  Back Issues  ·  Credits/Trademarks ·  Link To Us
Copyright © 1998-2010, ZATZ Publishing. All rights reserved worldwide.
Editor's Login