Oracle8i Application Developer's Guide - XML Release 3 (8.1.7) Part Number A86030-01 |
Library | Service | Contents | Index

Customizing Discoverer 3i Viewer with XSL, 9 of 9

## Frequently Asked Questions (FAQs): Discoverer 3i Viewer

### Explaining Servlets

#### Question

What is a servlet?

#### Answer

Servlets are modules of Java code that run in a server application (hence the name "Servlets", similar to "Applets" on the client side) to answer client requests. Servlets are not tied to a specific client-server protocol but they are most commonly used with HTTP and the word "Servlet" is often used in the meaning of "HTTP Servlet".

Servlets make use of the Java standard extension classes in the packages javax.servlet (the basic Servlet framework) and javax.servlet.http (extensions of the Servlet framework for Servlets that answer HTTP requests). Since Servlets are written in the highly portable Java language and follow a standard framework, they provide a means to create sophisticated server extensions in a server and operating system independent way.

Typical uses for HTTP Servlets include:

- Processing and storing data submitted by an HTML form.

- Providing dynamic content, such as returning the results of a database query to the client.

- Managing state information on top of the stateless HTTP, such as for an online shopping cart system which manages shopping carts for many concurrent customers and maps every request to the right customer.

### How Discoverer 3i Viewer Communicates with Browsers

#### Question

What does Discoverer 3I Viewer use to communicate with the user's browser?

#### Answer

HTTP and HTML.

### Why HTML is Output to the Browser

#### Question

Why does Discoverer 3i Viewer only output HTML to the user's browser?

#### Answer

Discoverer 3i Viewer outputs 100% HTML so that it can support the widest possible range of browsers. Using this architecture also avoids the need for an end user to perform an install or download.

### Discoverer 3i Viewer and XML

#### Question

How is XML used by Discoverer 3I Viewer?

#### Answer

XML is generated by the middle-tier and represents the application state. Discoverer 3iViewer Servlet interprets an HTTP request from the user's browser, and makes the necessary calls to the Discoverer Server.

The server response is represented in XML generated by the Servlet. XSL is applied to this XML, producing the HTML that is displayed by the users browser.

By using XML and XSL together, the underlying data and the look and feel are separated allowing easy customization.

### disco3iv.xml

#### Question

What does the disco3iv.xml file do?

#### Answer

You can use disco3iv.xml file to configure various options to make Discoverer 3i Viewer behave the way you want to. For example, you can specify the Discoverer Session that it should connect to.

XSL

### Discoverer 3i and XSL

#### Question

How is XSL used by Discoverer 3i Viewer?

#### Answer

Discoverer 3I Viewer uses XSL (or more specifically XSL-T) to transform the XML generated by the middle-tier into the HTML that is sent to the user's browser. By editing the XSL files, you gain complete control over the style and presentation of the UI.

### Supported XSL-T Processors

#### Question

What XSL processors can be used by Discoverer 3i Viewer?

#### Answer

Discoverer 3i Viewer can be configured to use:

- Oracle XSL -TProcessor (default, part of the XML Processor for Java)

- James Clark's XT (not supplied)

### Specifying the XSL-T Processor in the Servlet's Classpath

#### Question

How can you specify which XSL processor Discoverer 3i Viewer uses?

#### Answer

By default Discoverer 3i Viewer uses Oracle XSL-T Processor. If you prefer you can use James Clark's XT. The Servlet can be reconfigured to use the James Clark XSL processor as follows:

1. Include the XT processor in the servlet's classpath. The XT processor is available as a Zip file, xt.zip, from http://www.jclark.com/xml/xt.html

2. Unpack the Zip file to access the xt.jar file

   The JAR should be included in either the class path of the Servlet engine or the classpath for the Servlet engine zone. Different servlet engines have different ways of doing this.

   For example, for Apache JServ the servlet engine's class path is setup in the wrapper.classpath entry of the JServ.properties file. The classpath for the servlet zone is specified as a repository in the servlet zone properties.

   For details on how to set up each servlet engine read the section in the Discoverer Installation and Administration Guide on how Visibroker jar files are installed for that servlet engine. The process for installing the XT processor Jar file is identical.

3. Modify the Discoverer Viewer configuration file. Include the following line should in the <document> element of the disco3iv.xml configuration file:

        <argument name="xsl_processor">com.jclark.xsl.sax.XSLProcessor</argument>

4. Restart the web server.

### XSL Editors

#### Question

What tools are available to edit XSL Stylesheets?

#### Answer

You can use any text editor to edit XSL files however the following applications are designed especially for editing XSL:

- eXcelon Stylus

- IBM XSL Editor

### Customizing Stylesheets

#### Question

What is commonly changed in order to customize a stylesheet?

#### Answer

To customize a styelsheet, edit the following items:

- disco3iv.xsl to define the types of HTML pages and the rules for when they are displayed

- page_layouts.xsl to define the overall layout of each type of HTML page

- gui_components.xsl to define the look of each GUI component used in the page layouts

- style.xsl to define the style of various fonts used in Discoverer 3i Viewer

- errors.xsl to create your own custom error messages

- functions.xsl (not recommended) to change the behavior of the core functions used by the other XSL files

### Viewing Changes to a Modified Stylesheet

#### Question

When I customize my own XSL Stylesheet, why can't I see my changes?

#### Answer

By default, the XSL-T Processor caches the XSL files in its memory for better performance. You have two options for viewing the changes:

- Restart the servlet (by restarting the web server) every time you want to see your new changes. This makes the servlet re-read the XSL files from disk.

- Disable XSL caching. To do this, add the following line to the <document> section of the disco3iv.xml file and restart the web server.

      <argument name="xsl_cache">false</argument>

### Browser Displays Blank Screen

#### Question

Why does my browser display a blank screen?

#### Answer

This is usually because you have done either of the following:

- Called an XSL template that does not exist

- Tried to use a variable that does not exist

### More information on XML and XSL

#### Question

Where can I find more information on XML and XSL?

#### Answer

- http://java.sun.com/docs/books/tutorial/servlets/overview/index.html

- http://www.w3.org/Style/XSL/

- http://www.w3.org/XML/

- http://www.builder.com/Authoring/XmlSpot/?tag=st.cn.sr1.ssr.bl_xml

- http://zvon.vscht.cz/HTMLonly/XSLTutorial/Books/Book1/bookInOne.html

- http://www.arbortext.com/Think_Tank/Norm_s_Column/Issue_One/Issue_One.html

| Copyright © 1996-2000, Oracle Corporation. All Rights Reserved. |
Library | Service | Contents | Index