XAAL Documentation - Styling

Styling

Styling functionality was well specified by the ITiCSE XML Working Group, thus we will use the same specification here. The reason for the styling is to incorporate functionality similar to CSS, which are used together with XHTML documents to enforce a standard ``look and feel'' to an entire website. In our specification, we want to have something similar to relieve the author or system of the duty of redefining a particular style for every object.

The visual appearance of an object is specified by a style, which can specify stylistic properties, including:

  • whether it has a forward or backward arrow,
  • the object's color and fill-color
  • the font family, size, and style (bold, italic, or both),
  • and the object's stroke type.

Styles can also have an identifier (id), so that it can be referenced by multiple objects similarly to cascading style sheets in XHTML.

The few lines of XML in the following listing specify a style. When applied to a graphical primitive, for example line, this style specifies that the line should be solid (as opposed, say, to dashed), colored green, three pixels wide, and have an arrow tip in the ``forward'' direction. For the line object, the fill color and font size are not applicable, although they might be for other objects that reference this style definition.

<style id="style1">
 <arrow forward="true" backward="false"/>
 <color name="green"/>
 <fill-color name="yellow"/>
 <stroke type="solid" width="3"/>
 <font family="Monospaced" size="3"/>
</style>

To provide more versatile usage, style sheets can be extended. The style element can specify a style to be extended, and it allows elements to be overridden, as in listing below. In the example, style2 inherits all other properties of style1 except the color, which it redefines.

<style id="style2" uses="style1">
 <color red="0" green="240" blue="120"/>
</style>