1. The problem

In this chapter, we will use a custom XML schema: email.xsd. This schema is used to model a simple email message:

Using a CSS without custom extensions to style an email message gives good results, but here we want excellent results. And CSS alone cannot solve the following problems:

Problem #1

A message has From:, To:, Subject:, etc, headers. We would like to see the name of these headers displayed in French (De:, À:, Objet:, etc) if the user adds the attribute xml:lang=fr to the root message element.

Figure 8.1. A message having an xml:lang="fr" attribute
A message having an xml:lang="fr" attribute
Problem #2

An emphasis element can contain another emphasis element and this, at any nesting level. We would like emphasis elements having an even number of emphasis ancestors to be displayed using an italic font. We would like emphasis elements having an odd number of emphasis ancestors to be displayed using a plain (non-italic) font.

Figure 8.2. In the three following paragraphs, nested emphasis elements (containing words "nested emphasis text") are displayed using a non-italic font
In the three following paragraphs, nested emphasis elements (containing words "nested emphasis text") are displayed using a non-italic font
Problem #3

Like in DocBook, orderedlist elements have a continuation attribute. This attribute has two possible values:

restarts

This is the default value of the continuation attribute.

If a message body contains an orderedlist having 2 listitems (therefore numbered 1 and 2), followed by another orderedlist having 2 listitems and if the second orderedlist has continuation=restarts, its listitems are numbered 1 and 2.

continues

If a message body contains an orderedlist having 2 listitems (therefore numbered 1 and 2), followed by another orderedlist having 2 listitems and if the second orderedlist has continuation=continues, its listitems are numbered 3 and 4.

Figure 8.3. Two orderedlists, the second one having a continuation="continues" attribute
Two orderedlists, the second one having a continuation="continues" attribute
Problem #4

The text of a message can be interspersed with smileys (AKA emoticons) expressing emotions: happy, sad, tired, etc. Not only we would like these smiley elements to be represented graphically (, , , etc) but we also would like to use a combobox embedded in the document view to directly edit the emotion attribute of a smiley element.

Figure 8.4. Four smiley elements represented by four comboboxes
Four smiley elements represented by four comboboxes