Oracle8i Application Developer's Guide - XML Release 3 (8.1.7) Part Number A86030-01 |
|
Customizing Discoverer 3i Viewer with XSL, 8 of 9
You can use the XML and XSL fragments below to experiment with customization in a Web Browser.
The data is a standard XML file, similar to the previous "Discoverer XML Example 1":
<?xml version="1.0" encoding="UTF-8"?> <?xml-stylesheet type="text/xsl" href="example1.xsl"?> <discoverer version="3.5.8.12" login_method="discoverer"> <account name="myname@mydatabase" ref="MYNAME%40mydatabase"> <user>MYNAME</user> <database>mydatabase</database> <eul default="true" name="myeul"> <workbook name="Store and Band Analysis" ref="Store~20and~20Band~20Analysis"> <description>Shows sales by Store, broken into sales bands</description> </workbook> <workbook name="Video Sales Analysis" ref="Video~20Sales~20Analysis"> <description>General purpose analysis of the business</description> </workbook> <workbook name="Annual Sales Report" ref="Annual~20Sales~20Report"> <description>Shows yearly and quarterly sales of products</description> </workbook> </eul> </account> </discoverer>
The XML file starts by specifying the XML version. The 2nd line specifies the XSL file to be applied to process the data, "example1.xsl" and the rest of the file is generated from the Discoverer 3i Viewer.
The first two lines have been added here so that you can type the text into a file using a text editor and then open it in a Web Browser to see the results visually as the XSL is changed. Save the file with the extension "xml" if you want to try this.
XSL file, "example1.xsl", looks like this :
<?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/TR/WD-xsl"> <xsl:template match="/"> <html> <body bgcolor="#ffffff" link="#663300" text="#000000"> <b><i>Choose a Workbook:</i></b> <br/> <table border="2"> <xsl:for-each select="/discoverer/account/eul/workbook"> <tr> <td width="242"> <font face="sans-serif"> <xsl:value-of select="@name"/> </font> </td> <td> <xsl:value-of select="description"/> </td> </tr> </xsl:for-each> </table> </body> </html> </xsl:template> </xsl:stylesheet>
Figure 11-2 shows what you see on a Browser when the XML file is opened in the Browser, the Browser reads in the XSL stylesheet (example1.xsl), and generates HTML.
Table 11-1 examines the XSL file, example1.xsl, from line 5. It describes how the HTML is generated. The file starts by specifying the XML version. The 2nd line says that this file is a stylesheet. The HTML template starts with the <HTML> tag on line 4.
Note:
|
The XSL stylesheet is modified as follows:
<?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/TR/WD-xsl"> <xsl:template match="/"> <html> <body bgcolor="#ffffff" link="#663300" text="#000000"> <table border="0"> <tr> <td>width="500" height="100" background="disco_banner.gif"> <font face="sans-serif"> <b>Performance Reports</b> </font> </td> </tr> </table> <table border="0"> <xsl:for-each select="/discoverer/account/eul/workbook"> <tr> <td> <font face="sans-serif"> <b> <a href="link.htm"> <img src="button2.gif"> <xsl:attribute name="alt"> <xsl:value-of select="description"/> </xsl:attribute> </img> </a> </b> </font> </td> <td> <font face="sans-serif"> <xsl:value-of select="@name"/> </font> </td> </tr> </xsl:for-each> </table> </body> </html> </xsl:template> </xsl:stylesheet>
When this is combined with the same XML, it appears as shown in Figure 11-3.
Now the appearance of the User Interface is completely different, as it takes on a more graphical look and feel. Instead of text links there are graphical buttons for running the reports, each with a dynamic `tool tip' that pops up when you position the mouse over the button.
The modified XSL file is described in Table 11-2.
Figure 11-4 shows a typical web-based rendition of this sample application.
|
Copyright © 1996-2000, Oracle Corporation. All Rights Reserved. |
|