ZedAI Attaching Stylesheets

From zedwiki

Jump to: navigation, search

Overview

As Z39.86-AI documents are not intended to carry style information, a means of attaching CSS stylesheets for the rendering and display of content is necessary. The W3C Associating Style Sheets with XML documents specification has been selected as a simple means of fulfilling this requirement, as it employs processing instructions in an XML document's prolog as a general means for all compliant XML documents to reference external stylesheets.

(Note that the specification is currently under revision at http://www.w3.org/XML/2009/12/xml-stylesheet/, so the information in this document is subject to change.)

Attaching Stylesheets

Stylesheet references must only occur in the document prolog, which is the part of an XML document between the xml declaration at the start of the file and the root element:

<?xml version="1.0" encoding="utf-8"?>

<!-- document prolog -->

<document>
   ...
</document>

It is not valid to include these processing instructions anywhere else in the document (for example, in the head element as is common for associating CSS stylesheets with (X)HTML documents).

The processing instruction must be named xml-stylesheet. The href and type pseudo-attributes are then used to specify the type of stylesheet. For example, the following processing instruction could be used to attach a css stylesheet called default.css:

<?xml version="1.0" encoding="utf-8"?>

<?xml-stylesheet href="default.css" type="text/css"?>

<document>

The specification also includes pseudo-attributes that allow you to attach a descriptive title to your stylesheet declaration, to associate it with a specific media type, to specify the character set of the stylesheet and to set a stylesheet as an alternate:

<?xml version="1.0" encoding="utf-8"?>

<?xml-stylesheet href="default.css" type="text/css" 
   title="Primary print stylesheet" media="print" charset="utf-8"?>
<?xml-stylesheet href="alt.css" type="text/css" 
   title="Alternate print stylesheet" media="print" charset="utf-8" alternate="yes"?>

<document>

It is not permitted to create new pseudo-attributes.

Personal tools