| 1 |
<!-- -*- sgml -*- --> |
| 2 |
<html> |
| 3 |
|
| 4 |
<head> |
| 5 |
<meta http-equiv="Content-Type" |
| 6 |
content="text/html; charset=iso-8859-1"> |
| 7 |
<meta name="GENERATOR" content="Microsoft FrontPage Express 2.0"> |
| 8 |
<title>The OpenJade SGML/XML backend</title> |
| 9 |
</head> |
| 10 |
|
| 11 |
<body background="images/background.gif" bgcolor="#FFFFFF"> |
| 12 |
|
| 13 |
<p><font face="Geneva, Arial"><img src="images/dsssltitle.gif" |
| 14 |
alt="OpenJade" vspace="10" width="750" height="60"> </font></p> |
| 15 |
<div align="center"><center> |
| 16 |
|
| 17 |
<table border="0"> |
| 18 |
<tr> |
| 19 |
<td><font face="Geneva, Arial"><img |
| 20 |
src="images/space.gif" alt="" width="145" height="10"></font></td> |
| 21 |
<td><h1><font face="Geneva, Arial">The OpenJade SGML/XML backend</font></h1> |
| 22 |
<h3><font face="Arial">Created by James Clark</font></h3> |
| 23 |
<p><font face="Geneva, Arial">OpenJade does not support the |
| 24 |
DSSSL Transformation Language. However, it provides some |
| 25 |
simple, non-standardized extensions to the DSSSL Style |
| 26 |
Language that allow it to be used for SGML |
| 27 |
transformations.</font> </p> |
| 28 |
<p><font face="Geneva, Arial">These extensions are used |
| 29 |
in conjunction with the SGML backend which is selected |
| 30 |
with the <samp>-t sgml</samp> or <samp>-t xml</samp> |
| 31 |
options. Unlike other backends, the SGML backend writes |
| 32 |
its output to the standard output.</font> </p> |
| 33 |
<p><font face="Geneva, Arial">The <samp>-t xml</samp> |
| 34 |
option makes empty elements and processing instructions |
| 35 |
use the XML syntax. Note that the XML declaration is not |
| 36 |
automatically emitted.</font> </p> |
| 37 |
<p><font face="Geneva, Arial">The extensions consist of a |
| 38 |
collection of flow object classes that are used instead |
| 39 |
of the standard DSSSL-defined flow object classes:</font> |
| 40 |
</p> |
| 41 |
<dl> |
| 42 |
<dt><font face="Geneva, Arial"><code>element</code></font> |
| 43 |
</dt> |
| 44 |
<dt><font face="Geneva, Arial"><code>empty-element</code></font> |
| 45 |
</dt> |
| 46 |
<dd><font face="Geneva, Arial">Each of these flow |
| 47 |
objects results in an element in the output. The <code>element</code> |
| 48 |
flow object is a compound flow object (one that |
| 49 |
can have child flow objects). Both a start-tag |
| 50 |
and an end-tag are generated for this flow object. |
| 51 |
The <code>empty-element</code> is an atomic flow |
| 52 |
object (one that cannot have child flow objects). |
| 53 |
Only a start-tag is output for this. It should |
| 54 |
should be used for elements with a declared |
| 55 |
content of EMPTY or with a content reference |
| 56 |
attribute. Both of these flow objects support the |
| 57 |
following non-inherited characteristics:</font> <dl> |
| 58 |
<dt><font face="Geneva, Arial"><code>gi</code></font> |
| 59 |
</dt> |
| 60 |
<dd><font face="Geneva, Arial">This is a |
| 61 |
string-valued characteristic that |
| 62 |
specifies the element's generic |
| 63 |
identifier. It defaults to the generic |
| 64 |
identifier of the current node.</font> </dd> |
| 65 |
<dt><font face="Geneva, Arial"><code>attributes</code></font> |
| 66 |
</dt> |
| 67 |
<dd><font face="Geneva, Arial">This specifies |
| 68 |
the element's attributes as a list of |
| 69 |
lists each of which consists of exactly |
| 70 |
two strings, the first specifying the |
| 71 |
attribute name and the second the |
| 72 |
attribute value. It defaults to the empty |
| 73 |
list.</font> </dd> |
| 74 |
</dl> |
| 75 |
</dd> |
| 76 |
<dd> </dd> |
| 77 |
<dt><font face="Geneva, Arial"><code>processing-instruction</code></font> |
| 78 |
</dt> |
| 79 |
<dd><font face="Geneva, Arial">This is an atomic flow |
| 80 |
object that results in a processing instruction. |
| 81 |
It supports the following non-inherited |
| 82 |
characteristics:</font> <dl> |
| 83 |
<dt><font face="Geneva, Arial"><code>data</code></font> |
| 84 |
</dt> |
| 85 |
<dd><font face="Geneva, Arial">This is a |
| 86 |
string-valued characteristic that |
| 87 |
specifies the content of the processing |
| 88 |
instruction. It defaults to the empty |
| 89 |
string.</font> </dd> |
| 90 |
</dl> |
| 91 |
</dd> |
| 92 |
<dt><font face="Geneva, Arial"><code>document-type</code></font> |
| 93 |
</dt> |
| 94 |
<dd><font face="Geneva, Arial">This is an atomic flow |
| 95 |
object that results in a DOCTYPE declaration. It |
| 96 |
supports the following non-inherited |
| 97 |
characteristics:</font> <dl> |
| 98 |
<dt><font face="Geneva, Arial"><code>name</code></font> |
| 99 |
</dt> |
| 100 |
<dd><font face="Geneva, Arial">This is a |
| 101 |
string-valued characteristic that |
| 102 |
specifies the name of the document type (which |
| 103 |
must be the same as the name of the |
| 104 |
document element). It must not be omitted.</font> |
| 105 |
</dd> |
| 106 |
<dt><font face="Geneva, Arial"><code>system-id</code></font> |
| 107 |
</dt> |
| 108 |
<dd><font face="Geneva, Arial">This is a |
| 109 |
string-valued characteristic that |
| 110 |
specifies the system identifier of the |
| 111 |
document type. If non-empty, this will be |
| 112 |
used as the system identifier in the |
| 113 |
doctype declaration. The default value is |
| 114 |
the empty string.</font> </dd> |
| 115 |
<dt><font face="Geneva, Arial"><code>public-id</code></font> |
| 116 |
</dt> |
| 117 |
<dd><font face="Geneva, Arial">This is a |
| 118 |
string-valued characteristic that |
| 119 |
specifies the public identifier of the |
| 120 |
document type. If non-empty, this will be |
| 121 |
used as the public identifier in the |
| 122 |
doctype declaration. The default value is |
| 123 |
the empty string.</font> </dd> |
| 124 |
</dl> |
| 125 |
</dd> |
| 126 |
<dt><font face="Geneva, Arial"><code>entity</code></font> |
| 127 |
</dt> |
| 128 |
<dd><font face="Geneva, Arial">This is an compound |
| 129 |
flow object that stores its content in a separate |
| 130 |
entity. It supports the following non-inherited |
| 131 |
characteristic:</font> <dl> |
| 132 |
<dt><font face="Geneva, Arial"><code>system-id</code></font> |
| 133 |
</dt> |
| 134 |
<dd><font face="Geneva, Arial">The system |
| 135 |
identifier of the entity. For now this is |
| 136 |
treated as a filename not as an FSI.</font> |
| 137 |
</dd> |
| 138 |
</dl> |
| 139 |
<p><font face="Geneva, Arial">Note that no entity |
| 140 |
reference or declaration is emitted.</font> </p> |
| 141 |
</dd> |
| 142 |
<dt><font face="Geneva, Arial"><code>entity-ref</code></font> |
| 143 |
</dt> |
| 144 |
<dd><font face="Geneva, Arial">This is an atomic flow |
| 145 |
object that results in an entity reference. It |
| 146 |
supports the following non-inherited |
| 147 |
characteristic:</font> <dl> |
| 148 |
<dt><font face="Geneva, Arial"><code>name</code></font> |
| 149 |
</dt> |
| 150 |
<dd><font face="Geneva, Arial">The name of |
| 151 |
the entity.</font> </dd> |
| 152 |
</dl> |
| 153 |
</dd> |
| 154 |
<dt><font face="Geneva, Arial"><code>formatting-instruction</code></font> |
| 155 |
</dt> |
| 156 |
<dd><font face="Geneva, Arial">This is an atomic flow |
| 157 |
object that inserts characters into the output |
| 158 |
without change. It supports the following non-inherited |
| 159 |
characteristic:</font> <dl> |
| 160 |
<dt><font face="Geneva, Arial"><code>data</code></font> |
| 161 |
</dt> |
| 162 |
<dd><font face="Geneva, Arial">This is the |
| 163 |
string to be inserted.</font> </dd> |
| 164 |
</dl> |
| 165 |
<p><font face="Geneva, Arial">It differs from |
| 166 |
normal data characters in the <code>&</code>, |
| 167 |
<code><</code> and <code>></code> will not |
| 168 |
be escaped.</font> </p> |
| 169 |
</dd> |
| 170 |
</dl> |
| 171 |
<p><font face="Geneva, Arial">There is also the following |
| 172 |
characteristic:</font> </p> |
| 173 |
<dl> |
| 174 |
<dt><font face="Geneva, Arial"><code>preserve-sdata?</code></font> |
| 175 |
</dt> |
| 176 |
<dd><font face="Geneva, Arial">This is an inherited |
| 177 |
boolean characteristic that applies to character |
| 178 |
flow objects. When true, if the current-node for |
| 179 |
the character flow object was an sdata node, then |
| 180 |
the character will be output as a reference to an |
| 181 |
entity with the same name. The initial value is #f.</font> |
| 182 |
</dd> |
| 183 |
</dl> |
| 184 |
<p><font face="Geneva, Arial">Each of these flow object |
| 185 |
classes must be declared using <code>declare-flow-object-class</code> |
| 186 |
in any DSSSL specification that makes use of it. A |
| 187 |
suitable set of declarations is:</font> </p> |
| 188 |
<pre><font face="Geneva, Arial"> |
| 189 |
(declare-flow-object-class element |
| 190 |
"UNREGISTERED::James Clark//Flow Object Class::element") |
| 191 |
(declare-flow-object-class empty-element |
| 192 |
"UNREGISTERED::James Clark//Flow Object Class::empty-element") |
| 193 |
(declare-flow-object-class document-type |
| 194 |
"UNREGISTERED::James Clark//Flow Object Class::document-type") |
| 195 |
(declare-flow-object-class processing-instruction |
| 196 |
"UNREGISTERED::James Clark//Flow Object Class::processing-instruction") |
| 197 |
(declare-flow-object-class entity |
| 198 |
"UNREGISTERED::James Clark//Flow Object Class::entity") |
| 199 |
(declare-flow-object-class entity-ref |
| 200 |
"UNREGISTERED::James Clark//Flow Object Class::entity-ref") |
| 201 |
(declare-flow-object-class formatting-instruction |
| 202 |
"UNREGISTERED::James Clark//Flow Object Class::formatting-instruction") |
| 203 |
(declare-characteristic preserve-sdata? |
| 204 |
"UNREGISTERED::James Clark//Characteristic::preserve-sdata?" |
| 205 |
#f) |
| 206 |
</font></pre> |
| 207 |
<p><font face="Geneva, Arial">Here's a simple example |
| 208 |
that does the identity transformation:</font> </p> |
| 209 |
<pre><font face="Geneva, Arial"> |
| 210 |
<!doctype style-sheet PUBLIC "-//James Clark//DTD DSSSL Style Sheet//EN"> |
| 211 |
|
| 212 |
(declare-flow-object-class element |
| 213 |
"UNREGISTERED::James Clark//Flow Object Class::element") |
| 214 |
|
| 215 |
(define (copy-attributes #!optional (nd (current-node))) |
| 216 |
(let loop ((atts (named-node-list-names (attributes nd)))) |
| 217 |
(if (null? atts) |
| 218 |
'() |
| 219 |
(let* ((name (car atts)) |
| 220 |
(value (attribute-string name nd))) |
| 221 |
(if value |
| 222 |
(cons (list name value) |
| 223 |
(loop (cdr atts))) |
| 224 |
(loop (cdr atts))))))) |
| 225 |
|
| 226 |
(default (make element |
| 227 |
attributes: (copy-attributes))) |
| 228 |
</font></pre> |
| 229 |
<p><font face="Geneva, Arial">Note that this does not |
| 230 |
deal with empty elements nor processing instructions, nor |
| 231 |
does it include a doctype declaration.</font> </p> |
| 232 |
</td> |
| 233 |
</tr> |
| 234 |
</table> |
| 235 |
</center></div> |
| 236 |
|
| 237 |
<p> </p> |
| 238 |
</body> |
| 239 |
</html> |