Customizing the layout with XSL templates

Previous pageReturn to chapter overviewNext page

You can completely customize the layout of the explorer with the help of XSL templates.

XSL is a language for defining style sheets. It also includes a transformation language for XML documents: XSLT. Originally intended for complex styling operations, like generating indexes and tables of contents, it is now used as a general purpose XML processing language.

Styling requires two things: a source XML document containing the information the style sheet will display, and the style sheet itself (the XSL template) which describes how the information will look.

For more information about XSL and XML, see http://www.w3schools.com/xsl and http://www.w3schools.com/xml.

A StampCAT XSL template is a text file containing HTML instructions defining the layout of the page, and XSLT commands that extract and process data from the XML data file. In the standard templates, all HTML instructions are upper case, while the XSLT commands are lower case. This is not strictly necessary, but it makes the templates easier to read.

The standard StampCAT XSL templates are located in the Explorer Templates folder found below the main StampCAT folder (C:\Program Files\StampCAT\Explorer Templates, by default).

To switch to another template for a specific data type, choose Explorer Templates from the Tools menu. For example, StampCAT uses one template to display stamp data in the preview pane in the Stamp View (includes the most important data fields only), and another template when you explore a stamp in the Explorer window (which includes all fields).

To edit an existing template, open the file in your favourite text editor and make the necessary changes. We recommend that you backup the original template file before you do this.

Before you can create an XSL template, you must know the structure of the XML document the data is taken from. To see the XML structure, use the "Save to XML" command to generate an XML document with data from one record:

1.Activate the appropriate view, right-click a record in the browse list and choose Save to XML from the popup menu.
 
We recommend you select a record where all the fields you want to access from the template are filled in.
2.To view the XML document, open it in a text editor. You can also use Internet Explorer (version 5 or higher) which provides a tree structure with color coding and allows you to expand and collapse the nested elements:

xmlfile