Creating XML Lookup Table Style Sheets
Creating XML Lookup Table Style Sheets
1. Introduction
This document describes steps to create style sheets that look in another XML file as well as
the active XML file to obtain data for a combined output. The example in this document
produces an ASCII file, but the principles apply to HTML output as well.
This procedure applies to any application within the InRoads Group of products being
developed by the Civil Engineering Development group.
This document cannot teach everything needed to create XML style sheets. There are a
number of excellent books available on the subject and Bentley also offers a 3-day class on
InRoads Reporting with XML. This document only describes the steps necessary to create
style sheets that look in another XML file as well as the active XML file to obtain data for a
combined output.
2. Workflow
XSL provides a simple way to include one XML document into another, allowing values from
both documents to be combined into the final output. The following sections explain how to
combine and use multiple XML documents.
The declaration on the first line is a required entry. The simplest root element for any
user-created XML document is Document, but any element name can be used. The
child element names and their attribute names can also be anything desired by the
user. It is usually best to use a descriptive name with a minimum of abbreviations so
that anyone can look at the file and tell what the data represents.
In this example, a variable called numericCode is being populated with data from any
numericCode attribute from the included lookup table file (referenced by
$featureTableList) where the style attribute of the SurveyFeature element in the
lookup table matches the style attribute of the current point in the active XML
document.
3. References
Harold, Elliotte Rusty. XML Bible. IDG Books Worldwide, Inc, Foster City, CA, 1999.
Kay, Michael. XSLT Programmer's Reference 2nd Edition. Wrox Press, Ltd, Birmingham, UK,
2001.
4. Glossary
Terms used in this document are:
ASCII American Standard Code for Information Interchange – the character set
upon which most text files used by modern computers is based
Attribute A component of an XML or HTML element that provides additional
information about a specific instance of the element in the form of a
name="value" pair
Child element An element that is nested (contained) within another element
Comment An item in an XML or HTML document that is used to carry extraneous
information that is not part of the data; written between the delimiters <!--
and -->.
Element A markup tag, consisting of a start tag and an end tag, and the content, text,
or data, contained within the tag
Empty element An element with no content, although it may have attributes
HTML Hypertext Markup Language – an SGML application created for Web
documents
Markup Tags added to a document to define the pieces and parts of the document
and to describe the role they play; markup works on any computer
Meta language A language used for defining other languages
Parent element An element that has one or more elements nested within it
Root element The upper level parent element of which all other elements in the document
are children
SGML Standard Generalized Markup Language – a meta language created for
general document structuring
Tag HTML and XML code that delineates elements; tags can have three kinds of
meaning – structure, semantics and style
XML Extensible Markup Language – a text format for storing structured data; a
meta language based on simplified SGML created for Web use
XML style sheet Well-formed XML document that uses XSLT to transform XML data for
presentation
XSL / XSLT Extensible Style Sheet Language: Transformations – an advanced style
sheet mechanism that provides browsers with formatting and display
information