Station Details Project

This was an eXtensible Stylesheet Language (XSL) Tranformation (XSLT) self-education exercise. XSL is a styling language for XML that defines how data will be displayed in another format.

The aim of the project was to create a dynamic XML-based HTML page showing our weather station details to replace the static HTML page that existed at the time. It was intended that our PWS software would be programmed to automatically generate the XML document at regular intervals.

Project Stages

The stages of the project were as follows:

  1. Match variables with the required station and instrument details,
  2. Create an XML Schema Definition (XSD) document specifying the structure of the new Station Details Document (or stn-info-xml),
  3. Create an XSL document to specify how the XML data would be displayed in HTML, and
  4. Finalise the template files for (1) routine XSLT, and (2) XML validation.

Project Variables

The variables used in this project are listed below. Select a variable to view the complete XML element definition, including: the element name and description, the expected data type, the permitted values where explicitly defined, and whether the element is mandatory or optional.

The variables in the template file are replaced with the equivalent output tags from the PWS software. If a variable has no equivalent output tag from the PWS software, the options are to: (1) create a user-defined output tag for the PWS software containing the appropriate value, or (2) replace the variable in the template file with the appropriate value. If an optional variable is permanently unavailable, the template file is edited as per this example - replace <foo>%variable%</foo> with <foo />.

Top of page up arrow

XML Schema Definition

View the XSD diagram for this project.

Template Files

Two template files were created. One template is used to validate the XML document, whilst the other is used to transform the XML document into HTML.

Download templates (right click on the link and select "Save link as"): validation template | transformation template.

Note: The current templates were released at 13:00 UTC on 27 June 2020. Earlier versions will no longer validate or style correctly.

See an example of stn-info-xml with default styling.

Using the Validation Template

This template is used to ensure the XML document is valid and contains no errors. An invalid document will not display in a web browser. An error usually means the offending datum does not match a permitted value or data type.

  1. Create an XML document using the validation template,
  2. Test the XML document with XML Validator,
  3. Correct any validation errors and retest, and
  4. Correct the identical validation errors in the original source of the details.

Project Status

Visit About Truganina Weather to view our current Station Details & Instrumentation using stn-info-xml.

This 2020 project successfully achieved its aims and is operational. The project remains open for possible further development.

Top of page up arrow