XSL information

The XML Stylesheet Language is intended to specify a presentation of XML encoded data. The style sheet is to be developed by experts in layout and formatting, as hown in the figure below.

Illustration of workflow for XML and XSL.

There is a strong influence from SGML, in that there are a mnyriad of specifications to make a beautifully formatted layout. Our examples ignore them.

XSL fumctionality is based on templates. Templates are specifications that refer to the XML tags. When a template is used a match to corresponding tags in the XML document is attempted. When a match is found the data values following the XML tags in the XML file can be placed into the HTML document. The data will be surrounded by HTML commands that provide the appropriate formatting. For instance, the XSL template statement below
<TD><B> <xsl:value-of select="firstyear" /></B></TD>
will generate a boldface (<B> .. </B>) HTML table entry (<TD> .. </TD> for the data values enclosed in the XML tags <xsl:value-of select="firstyear" />.

Since an XML file can have nested tags, an important function of the templates is to descend to the right level of nesting. Not every match then causes data fields to be picked up and written. However, if the HTML document to be generated is to follow the nested layout of the XML document, one will want to place at least suitable header information into the HTML file. XSL also provides commands for looping, say to generate lines corresponding to multiple entries at a nesting level of an XML document.


DTD for XSL per 1997 proposal

Dots ... for spacing legibility.

<!-- This DTD is for exegesis only. It assumes that the
action parameter entity has been defined as an or-group
of flow object elements. The style parameter entity is
used to represent an or-group of the apply element
and styles defined with define-style. -->

<!ENTITY % pattern "(root | (target-element | element | any)*)">

<!ELEMENT rule (%pattern;, %action;) >

<!ELEMENT style-rule (%pattern;, %style)>

<!ELEMENT root..EMPTY>

<!ATTLIST (rule | style-rule)
........priority.. NUMBER.... #IMPLIED
........importance NUMBER.... #IMPLIED
........mode...... NAME...... #IMPLIED>

<!ELEMENT target-element
........(attribute*, (element+ | any)?)....-(target-element)>

<!ELEMENT element
........(attribute*, (target-element | element | any)?) >

<!ELEMENT any..EMPTY >

<!ATTLIST (target-element | element)
........type......NAME........#IMPLIED
........id........NAME........#IMPLIED
........class.... NAME........#IMPLIED
........only....(of-type|of-any)..#IMPLIED
........position..(first-of-type|last-of-type|first-of-any|last-of-any)..#IMPLIED
>

<!ELEMENT attribute EMPTY >

<!ATTLIST attribute
........name.... NAME........#REQUIRED
........value.. CDATA......#IMPLIED
........has-value (yes|no)....[A'yes'
>