How to apply XSL style sheets to XML views

Learn how you can apply XSL style sheets to your XML views without the pain of creating several templates.

In this tip, I will show you an easy way to apply XSL (Extensible Style Language) style sheets to an XML view without the pain of creating numerous view templates.

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:

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 name of the XSL file in the URL Query String and the browser does the rest.

Do you have comments on this tip? Let us know.

Related information from

  • Learning Guide: Extensible Markup Language
  • Reference Center: XML/Web services tips and resources

    This tip was submitted to the 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.

  • Dig Deeper on XML and Web Services for Lotus Notes Domino

    Start the conversation

    Send me notifications when other members comment.

    Please create a username to comment.




    • iSeries tutorials's tutorials provide in-depth information on the iSeries. Our iSeries tutorials address areas you need to know about...

    • V6R1 upgrade planning checklist

      When upgrading to V6R1, make sure your software will be supported, your programs will function and the correct PTFs have been ...

    • Connecting multiple iSeries systems through DDM

      Working with databases over multiple iSeries systems can be simple when remotely connecting logical partitions with distributed ...