If you have any XML views in your application, chances are you will be applying an XSL style sheet to them -- using complicated JavaScript routines. For presentation's sake, there is an easier way.
For example, let's say you have one XML view and six XSL style sheets. In this example, you will use a page to store your XSL.
First, create a form to be used as your view template. The form should be either HTML or text/XML. The form will be opened with a URL like this:
http://server/db.nsf/myform?ReadForm&view=XMLVIEW1&xsl=xslpage1
Your embedded view will be XMLVIEW, which is a formula computed using @URLQueryString("view").
At the top of the form, you will define the XML details -- including which style sheet to apply. Your computed value will be the @WebDbName of your database, plus @URLQueryString("XSL"), as shown below:
<?xml version="1.0" encoding="UTF-8" ?> <?xml-stylesheet type="text/xsl" href="<computed value>"?>
The XML style sheet line tells the browser to pre-format your XML with the XSL page you specified.
How you store the XSL in the database is up to you, but you could make it accessible to advanced users to enable them to manipulate data without needing to create any more views.
To finish, pass the
Requires Free Membership to View
Register today to access targeted resources from our editorial writers and independent industry experts focused on Lotus Domino, Notes, Workplace and other related technologies.
Do you have comments on this tip? Let us know.
Related information from SearchDomino.com:
This tip was submitted to the SearchDomino.com tip library by member Ben Rodway. Please let others know how useful it is via the rating scale below. Do you have a useful Lotus Notes, Domino, Workplace or WebSphere tip or code snippet to share? Submit it to our monthly tip contest and you could win a prize.
This was first published in February 2007