XML 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.

Development was a five stage process:

  1. Match variables with the required station and instrument details,
  2. Create an XML document to transfer the station and instrument details,
  3. Create an XML Schema Definition (XSD) document to ensure the XML document is well-formed and valid,
  4. Create an XSL document to specify how the data in the XML document will be displayed in HTML, and
  5. Create template files culminating from the previous four stages.

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 a live example using the transformation template 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 Station Details & Instrumentation using the XML Station Details Document.

This 2020 project is still active.

Top of page up arrow