From Adlib 6.6.0 (not supported in Collections) you can place a special web browser box on a detail screen (not on a brief display screen) in your application, to display record data as a web page. The box is only meant for display, and possibly printing, but not for editing.
You do need an XSLT stylesheet for this: under the hood of Adlib, all data is processed as XML, and with an XSLT stylesheet XML can be transformed to HTML, for example, while HTML can be displayed as a web page in a web browser and in the web browser box in Adlib.
Such a web browser box can be useful when you want to present the user of Adlib with a nice presentation of the record in a single box. Or maybe you have a website which displays records in detail, and you would like to have the same presentation available in Adlib as well, so that during record entry a registrar can already see how the record will look on the website. Every time the screen is redrawn during entry or editing, for instance when you switch tabs, the web page display will be updated. You can implement a web browser box as follows:

1.Create an XSLT stylesheet to transform Adlib XML of records from a certain database into HTML. Assume this is grouped XML as generated by the Adlib API too (also see the paragraph about the XML format below). Download the Museum example stylesheet (MuseumRecordInWebBrowserControl.xslt) from the Adlib website, or use the Adlib Office Connect stylesheets to start with. The example file contains an assumed, fixed relative path to the images folder: you should change this path to the (path to the) folder which actually contains your images. You are of course free to further adjust these stylesheets to your requirements. Place the stylesheet in a suitable location in your Adlib Software folder, maybe the folder with the name of the application, or in a new \stylesheets subfolder
2.Suppose you would like to be able to view an object record as a web page, then search your object catalogue for a screen with enough empty space to hold the web page presentation, or create a new screen. In this example we use the Documentation (free) screen (docfarch.fmt). Open the selected screen in the Screen editor.
3.Click Insert > Web browser control in the menu bar. A box with the icon of a globe will be placed on the screen. Drag it to the desired spot and make the box as big as you like by dragging its edges. When the HTML page is shown on this screen in your Adlib application, the box will have this exact size and cannot be adjusted there.
4.Right-click the new box and choose Properties in the pop-up menu which opens. There’s only one option available. Click the … button to search for the desired XSLT stylesheet on your system. The path to the file must be relative to the application folder, and the .xslt extension must be present behind the file name.
5.Save the changes in the screen and view the result in Adlib by opening a record and switching to the adjusted tab.

You can copy the web page display if you want, and paste it in a Word document. Right-click the display and choose Select all. Press Ctrl+C to copy everything. Switch to your Word document and paste the text (Ctrl+V).
If you like, you can even print the web page display directly. Right-click the display and choose Print… in the pop-up menu. With the standard Windows print dialog you can then actually start the printing.
It is possible that on the printout a page numbering, date and other header and footer information can be seen, and that background colours won’t print. This is caused by page settings in Internet Explorer, because the web browser box uses IE functionality for printing. In Internet Explorer 9 you can change these settings via the menu (press Alt) File > Page setup or via the Tools button (Alt+X) Print > Page setup. For example, mark the Print background colours and images option to be able to print background colours. The headers and footers can be changed here as well.

The XML format and the generated HTML

After setup, it is easy to find out how the record XML is structured exactly. You don’t need to have an advanced stylesheet already or even one that works, to be able to view the XML. Right-click the web browser box in your active Adlib application and choose View > Record XML in the pop-up menu. The entire contents of the record will be diplayed as XML in Windows NotePad. To obtain a better presentation of the XML, you can save the file with the .xml extension, and double-click it in Windows Explorer. The file will open in a program able to display XML properly, like Internet Explorer. Now, the XML structure is clear and you’ll be able to customize your stylesheet efficiently.

Via the same pop-up menu you can display the generated HTML as well. Your stylesheet converts record XML into HTML and the result can be shown with View > Page source. Correct HTML code will be presented only if your stylesheet works properly.

System variables which can be used in the stylesheet

When the detail screen with the web browser control is formatted for display, three parameters are passed to the XSLT stylesheet: the currently selected data language, the current user interface language and the background color of the Adlib screen. These variables must be used as follows:

data_language – the currently selected data language as an IETF language tag (as also used by Adlib in other multilingual functionality). From Adlib 7.0.0.106, the language tag is a code put together from an abbreviation for a language and a region identifier: for more information about this, see the “Using Language Identifiers (RFC 3066)” document which you can find on the internet. The code for British English, for example, is en-GB. In a stylesheet for a multilingual Adlib SQL or Adlib Oracle database you can use this parameter to select the data language in which you want to display field contents. See the MultilingualRecordInWebBrowserControl.xslt example stylesheet for the code behind a possible application of this functionality, for a multilingual page_title field.
ui_language – the current user interface language as referenced in Adlib. For example, English is 0, while Dutch is 1. You can use this to present fixed texts in the display in the current interface language. See the MuseumRecordInWebBrowserControl.xslt example stylesheet for a way to use this parameter.
background_color – the background colour of the screen as a hexadecimal HTML colour code (#rrggbb). You can use this parameter to provide the HTML page with the same background colour as the Adlib screen, if desired.

To use the parameters in a stylesheet, declare them as a regular XSLT parameter without a default value (because it will be overwritten anyway) somewhere in the file, for example:

<xsl:param name="background_color"></xsl:param>
<xsl:param name="data_language”></xsl:param>
<xsl:param name="ui_language"></xsl:param>

The background colour can be used like this, for example:

<style type="text/css">
 body { background: <xsl:value-of select="$background_color"/>; }
</style>

Error handling

Any errors in the stylesheet will be shown inside of the web browser control with line and column numbers, and an explanation for the failure.

Testing a stylesheet that you are still working on, is very easy. Once you’ve set it up like explained above, and you are currently showing a record in detailed display with the web browser box, you only need to switch tabs to reload the stylesheet. So after every change in your stylesheet, save it, switch tabs in Adlib, and you can see the effect of your latest adjustment immediately

Note

Every XSLT stylesheet for the current application will contain fixed HTML code. That means you can also add URLs to web pages. Use target="_blank" in the reference to have the link opened in your default web browser. If you leave target="_blank" out, the web page will open in the Adlib web browser box. Example:

<a target="_blank" href="http://www.adlibsoft.com">Adlib</a>