| 1 |
<!DOCTYPE style-sheet PUBLIC "-//James Clark//DTD DSSSL Style Sheet//EN" [ |
| 2 |
<!ENTITY docbook.dsl PUBLIC "-//Norman Walsh//DOCUMENT DocBook Print Stylesheet//EN" CDATA dsssl> |
| 3 |
]> |
| 4 |
|
| 5 |
<style-sheet> |
| 6 |
<style-specification id="print" use="docbook"> |
| 7 |
<style-specification-body> |
| 8 |
|
| 9 |
(define show-comments #f) |
| 10 |
|
| 11 |
(define read-entity |
| 12 |
(external-procedure "UNREGISTERED::James Clark//Procedure::read-entity")) |
| 13 |
|
| 14 |
(define (book-titlepage-verso-elements) |
| 15 |
(list (normalize "title") |
| 16 |
(normalize "subtitle") |
| 17 |
(normalize "corpauthor") |
| 18 |
(normalize "authorgroup") |
| 19 |
(normalize "author") |
| 20 |
(normalize "editor") |
| 21 |
(normalize "edition") |
| 22 |
(normalize "pubdate") |
| 23 |
(normalize "releaseinfo") |
| 24 |
(normalize "copyright") |
| 25 |
(normalize "abstract") |
| 26 |
(normalize "legalnotice") |
| 27 |
(normalize "revhistory"))) |
| 28 |
|
| 29 |
(define %refentry-generate-name% #f) |
| 30 |
(define %refentry-function% #f) |
| 31 |
(define %generate-titlepage% #f) |
| 32 |
(define %generate-toc% #f) |
| 33 |
(define %generate-lot-list% '()) |
| 34 |
(define %refentry-new-page% #f) |
| 35 |
(define %two-side% #t) |
| 36 |
(define %refentry-keep% #f) |
| 37 |
|
| 38 |
(define %cals-rule-default% "1") |
| 39 |
|
| 40 |
(define %line-spacing-factor% 1.1) |
| 41 |
|
| 42 |
(define %verbatim-size-factor% 0.9) |
| 43 |
|
| 44 |
(define %graphic-default-extension% "gif") |
| 45 |
|
| 46 |
;; ------ |
| 47 |
|
| 48 |
(define (first-page-center-footer gi) |
| 49 |
(let* ((docinfo (select-elements (children (current-node)) |
| 50 |
(normalize "docinfo"))) |
| 51 |
(relinfo (select-elements (children docinfo) |
| 52 |
(normalize "releaseinfo")))) |
| 53 |
(if (node-list-empty? relinfo) |
| 54 |
(empty-sosofo) |
| 55 |
(literal (data relinfo))))) |
| 56 |
|
| 57 |
(define (page-center-footer gi) |
| 58 |
(first-page-center-footer gi)) |
| 59 |
|
| 60 |
;; ------ |
| 61 |
|
| 62 |
(define (gentext-usen-xref-strings giname) |
| 63 |
(case giname |
| 64 |
(("APPENDIX") (if %chapter-autolabel% |
| 65 |
"Appendix %n, %t" |
| 66 |
"the appendix called %t")) |
| 67 |
(("ARTICLE") (string-append %gentext-usen-start-quote% |
| 68 |
"%t" |
| 69 |
%gentext-usen-end-quote%)) |
| 70 |
(("BIBLIOGRAPHY") "%t") |
| 71 |
(("BOOK") "%t") |
| 72 |
(("CHAPTER") (if %chapter-autolabel% |
| 73 |
"Chapter %n, %t" |
| 74 |
"the chapter called %t")) |
| 75 |
(("EQUATION") "Equation %n") |
| 76 |
(("EXAMPLE") "Example %n") |
| 77 |
(("FIGURE") "Figure %n") |
| 78 |
(("INFORMALTABLE") "%kg %kn") |
| 79 |
(("LISTITEM") "%n") |
| 80 |
(("PART") "Part %n") |
| 81 |
(("PREFACE") "%t") |
| 82 |
(("PROCEDURE") "Procedure %n, %t") |
| 83 |
(("SECT1") (if %section-autolabel% |
| 84 |
"Section %n" |
| 85 |
"the section called %t")) |
| 86 |
(("SECT2") (if %section-autolabel% |
| 87 |
"Section %n" |
| 88 |
"the section called %t")) |
| 89 |
(("SECT3") (if %section-autolabel% |
| 90 |
"Section %n" |
| 91 |
"the section called %t")) |
| 92 |
(("SECT4") (if %section-autolabel% |
| 93 |
"Section %n" |
| 94 |
"the section called %t")) |
| 95 |
(("SECT5") (if %section-autolabel% |
| 96 |
"Section %n" |
| 97 |
"the section called %t")) |
| 98 |
(("STEP") "step %n") |
| 99 |
(("TABLE") "Table %n") |
| 100 |
(("TITLE") "%kg %kn") |
| 101 |
(else (string-append "[xref to " |
| 102 |
(if giname |
| 103 |
giname |
| 104 |
"non-existant element") |
| 105 |
" unsupported]")))) |
| 106 |
|
| 107 |
;(declare-initial-value top-margin 5pi) |
| 108 |
;(declare-initial-value bottom-margin 6pi) |
| 109 |
;(declare-initial-value footer-margin 4pi) |
| 110 |
|
| 111 |
;(define %visual-acuity% "tiny") |
| 112 |
;(define %page-n-columns% 2) |
| 113 |
;(define %paper-type% "USlandscape") |
| 114 |
;(define %left-margin% 4pi) |
| 115 |
;(define %right-margin% 4pi) |
| 116 |
|
| 117 |
(element REFENTRY |
| 118 |
(make display-group |
| 119 |
keep: %refentry-keep% |
| 120 |
(if %refentry-new-page% |
| 121 |
(make simple-page-sequence |
| 122 |
page-number-format: ($page-number-format$) |
| 123 |
use: default-text-style |
| 124 |
left-header: ($left-header$) |
| 125 |
center-header: ($center-header$) |
| 126 |
right-header: ($right-header$) |
| 127 |
left-footer: ($left-footer$) |
| 128 |
center-footer: ($center-footer$) |
| 129 |
right-footer: ($right-footer$) |
| 130 |
input-whitespace-treatment: 'collapse |
| 131 |
quadding: %default-quadding% |
| 132 |
($refentry-title$) |
| 133 |
(process-children)) |
| 134 |
(make sequence |
| 135 |
(make rule |
| 136 |
orientation: 'horizontal |
| 137 |
line-thickness: 2pt) |
| 138 |
($refentry-title$) |
| 139 |
($block-container$))) |
| 140 |
(make-endnotes))) |
| 141 |
|
| 142 |
;;(element (SYNOPSIS SGMLTAG) ($charseq$)) |
| 143 |
|
| 144 |
(element sgmltag |
| 145 |
(let* ((class (if (attribute-string (normalize "class")) |
| 146 |
(attribute-string (normalize "class")) |
| 147 |
(normalize "element"))) |
| 148 |
(content (data (current-node))) |
| 149 |
(linkend (if (equal? class (normalize "paramentity")) |
| 150 |
;; hack; some of the paramentity ids don't start |
| 151 |
;; with dbre... |
| 152 |
(if (node-list-empty? (element-with-id |
| 153 |
(string-append "dbre.pent." |
| 154 |
content))) |
| 155 |
(string-append "pent." content) |
| 156 |
(string-append "dbre.pent." content)) |
| 157 |
(string-append "dbre.elem." content))) |
| 158 |
(target (element-with-id linkend)) |
| 159 |
; (err (if (node-list-empty? target) |
| 160 |
; (debug (string-append |
| 161 |
; "Unresolved SGMLTAG (CLASS=" |
| 162 |
; class |
| 163 |
; "): " |
| 164 |
; content)) |
| 165 |
; ""))) |
| 166 |
) |
| 167 |
<![CDATA[ |
| 168 |
(cond |
| 169 |
((equal? class (normalize "attribute")) ($charseq$)) |
| 170 |
((equal? class (normalize "attvalue")) ($mono-seq$)) |
| 171 |
|
| 172 |
((equal? class (normalize "element")) |
| 173 |
(if (or (has-ancestor-member? (current-node) |
| 174 |
(list (normalize "link"))) |
| 175 |
(node-list-empty? target)) |
| 176 |
($mono-seq$) |
| 177 |
(make link |
| 178 |
destination: (node-list-address target) |
| 179 |
($mono-seq$)))) |
| 180 |
|
| 181 |
((equal? class (normalize "endtag")) ($mono-seq$ (make sequence |
| 182 |
(literal "</") |
| 183 |
(process-children) |
| 184 |
(literal ">")))) |
| 185 |
((equal? class (normalize "genentity")) ($mono-seq$ (make sequence |
| 186 |
(literal "&") |
| 187 |
(process-children) |
| 188 |
(literal ";")))) |
| 189 |
((equal? class (normalize "numcharref")) ($mono-seq$ (make sequence |
| 190 |
(literal "&#") |
| 191 |
(process-children) |
| 192 |
(literal ";")))) |
| 193 |
((equal? class (normalize "paramentity")) |
| 194 |
(if (or (has-ancestor-member? (current-node) |
| 195 |
(list (normalize "link"))) |
| 196 |
(node-list-empty? target)) |
| 197 |
($mono-seq$ (make sequence |
| 198 |
(literal "%") |
| 199 |
(process-children) |
| 200 |
(literal ";"))) |
| 201 |
(make link |
| 202 |
destination: (node-list-address target) |
| 203 |
($mono-seq$ (make sequence |
| 204 |
(literal "%") |
| 205 |
(process-children) |
| 206 |
(literal ";")))))) |
| 207 |
|
| 208 |
((equal? class (normalize "pi")) ($mono-seq$ (make sequence |
| 209 |
(literal "<?") |
| 210 |
(process-children) |
| 211 |
(literal "?>")))) |
| 212 |
((equal? class (normalize "starttag")) ($mono-seq$ (make sequence |
| 213 |
(literal "<") |
| 214 |
(process-children) |
| 215 |
(literal ">")))) |
| 216 |
((equal? class (normalize "sgmlcomment")) ($mono-seq$ (make sequence |
| 217 |
(literal "<!--") |
| 218 |
(process-children) |
| 219 |
(literal "-->")))) |
| 220 |
]]> |
| 221 |
(else ($charseq$))))) |
| 222 |
|
| 223 |
|
| 224 |
(element ulink |
| 225 |
(let* ((url (attribute-string (normalize "url"))) |
| 226 |
(content (data (current-node))) |
| 227 |
(data-is-url? (and (> (string-length content) 6) |
| 228 |
(or (equal? (substring content 0 6) "ftp://") |
| 229 |
(equal? (substring content 0 6) "http:/"))))) |
| 230 |
(if data-is-url? |
| 231 |
($italic-seq$) |
| 232 |
(make sequence |
| 233 |
($charseq$) |
| 234 |
($italic-seq$ (literal " (" url ")")))))) |
| 235 |
|
| 236 |
(element COMMENT |
| 237 |
(let* ((colr-space (color-space |
| 238 |
"ISO/IEC 10179:1996//Color-Space Family::Device RGB")) |
| 239 |
(red (color colr-space 1 0 0))) |
| 240 |
(if show-comments |
| 241 |
(make sequence |
| 242 |
color: red |
| 243 |
start-indent: 0pt |
| 244 |
($italic-seq$)) |
| 245 |
(empty-sosofo)))) |
| 246 |
|
| 247 |
(element EMPHASIS |
| 248 |
(if (equal? (normalize (attribute-string "ROLE")) (normalize "bold")) |
| 249 |
($bold-seq$) |
| 250 |
($italic-seq$))) |
| 251 |
|
| 252 |
(element OPTION |
| 253 |
($italic-seq$)) |
| 254 |
|
| 255 |
(element COMMAND |
| 256 |
($italic-seq$)) |
| 257 |
|
| 258 |
(element PHRASE |
| 259 |
(let ((rev (attribute-string "REVISIONFLAG"))) |
| 260 |
(if (equal? rev "DELETED") |
| 261 |
(make score |
| 262 |
type: 'through |
| 263 |
(process-children)) |
| 264 |
(process-children)))) |
| 265 |
|
| 266 |
(element (ENTRY SIMPLELIST) |
| 267 |
(make paragraph |
| 268 |
(process-children))) |
| 269 |
|
| 270 |
(element (ENTRY SIMPLELIST MEMBER) |
| 271 |
(make sequence |
| 272 |
(if (equal? (child-number) 1) |
| 273 |
(empty-sosofo) |
| 274 |
(make paragraph-break)) |
| 275 |
(process-children))) |
| 276 |
|
| 277 |
(element (refsynopsisdiv variablelist varlistentry term) |
| 278 |
(let ((termlength |
| 279 |
(attribute-string (normalize "termlength") (ancestor (normalize "variablelist"))))) |
| 280 |
(make paragraph |
| 281 |
font-weight: 'bold |
| 282 |
space-before: %para-sep% |
| 283 |
end-indent: (if termlength |
| 284 |
(- %text-width% (measurement-to-length termlength)) |
| 285 |
0pt) |
| 286 |
(process-children)))) |
| 287 |
|
| 288 |
(define ($refentry-title$) |
| 289 |
;; all this work, just to make the icons appear if it's a new element |
| 290 |
(let* ((role (attribute-string (normalize "role") (current-node))) |
| 291 |
(rev (attribute-string (normalize "revision") (current-node))) |
| 292 |
(imgf (cond |
| 293 |
((equal? rev "3.1") "figures/rev_3.1.eps") |
| 294 |
((equal? rev "4.0") "figures/rev_4.0.eps") |
| 295 |
((equal? rev "5.0") "figures/rev_5.0.eps") |
| 296 |
(else "MISSING_REVISION_FIGURE")))) |
| 297 |
(refmeta (select-elements (children (current-node)) |
| 298 |
(normalize "refmeta"))) |
| 299 |
(refentrytitle (select-elements (children refmeta) |
| 300 |
(normalize "refentrytitle"))) |
| 301 |
(refnamediv (select-elements (children (current-node)) |
| 302 |
(normalize "refnamediv"))) |
| 303 |
(refdescriptor (select-elements (children refnamediv) |
| 304 |
(normalize "refdescriptor"))) |
| 305 |
(refname (select-elements (children refnamediv) |
| 306 |
(normalize "refname"))) |
| 307 |
(title (if (node-list-empty? refentrytitle) |
| 308 |
(if (node-list-empty? refdescriptor) |
| 309 |
(node-list-first refname) |
| 310 |
refdescriptor) |
| 311 |
refentrytitle)) |
| 312 |
(slevel (SECTLEVEL)) ;; the true level in the section hierarchy |
| 313 |
(hlevel (if (> slevel 2) 2 slevel)) ;; limit to sect2 equiv. |
| 314 |
(hs (HSIZE (- 4 hlevel)))) |
| 315 |
(make paragraph |
| 316 |
font-family-name: %title-font-family% |
| 317 |
font-weight: 'bold |
| 318 |
font-size: hs |
| 319 |
line-spacing: (* hs %line-spacing-factor%) |
| 320 |
space-before: (* hs %head-before-factor%) |
| 321 |
space-after: (* hs %head-after-factor%) |
| 322 |
start-indent: %body-start-indent% |
| 323 |
first-line-start-indent: (- %body-start-indent%) |
| 324 |
quadding: 'start |
| 325 |
heading-level: (if %generate-heading-level% 2 0) |
| 326 |
keep-with-next?: #t |
| 327 |
|
| 328 |
;; I can't actually get images working for EPS |
| 329 |
; (if (equal? role "new") |
| 330 |
; (make sequence |
| 331 |
; (make external-graphic |
| 332 |
; entity-system-id: imgf |
| 333 |
; display?: #f |
| 334 |
; display-alignment: 'start) |
| 335 |
; (literal "\no-break-space;")) |
| 336 |
; (empty-sosofo)) |
| 337 |
(if (equal? role "new") |
| 338 |
(make sequence |
| 339 |
font-weight: 'bold |
| 340 |
(literal "(" rev ")") |
| 341 |
(literal "\no-break-space;")) |
| 342 |
(empty-sosofo)) |
| 343 |
|
| 344 |
(process-node-list (children title)) |
| 345 |
|
| 346 |
(if %refentry-function% |
| 347 |
(sosofo-append |
| 348 |
(literal "\no-break-space;") |
| 349 |
(process-first-descendant (normalize "manvolnum"))) |
| 350 |
(empty-sosofo))))) |
| 351 |
|
| 352 |
(define ($section-title$) |
| 353 |
;; all this work, just to make the icons appear if there's an FU comment |
| 354 |
;; on a refsect2... |
| 355 |
(let* ((role (attribute-string (normalize "role") (current-node))) |
| 356 |
(rev (attribute-string (normalize "revision") (current-node))) |
| 357 |
(imgf (cond |
| 358 |
((equal? rev "3.1") "figures/rev_3.1.eps") |
| 359 |
((equal? rev "4.0") "figures/rev_4.0.eps") |
| 360 |
((equal? rev "5.0") "figures/rev_5.0.eps") |
| 361 |
(else "MISSING_REVISION_FIGURE"))) |
| 362 |
(sect (current-node)) |
| 363 |
(info (info-element)) |
| 364 |
(exp-children (if (node-list-empty? info) |
| 365 |
(empty-node-list) |
| 366 |
(expand-children (children info) |
| 367 |
(list (normalize "bookbiblio") |
| 368 |
(normalize "bibliomisc") |
| 369 |
(normalize "biblioset"))))) |
| 370 |
(parent-titles (select-elements (children sect) (normalize "title"))) |
| 371 |
(info-titles (select-elements exp-children (normalize "title"))) |
| 372 |
(titles (if (node-list-empty? parent-titles) |
| 373 |
info-titles |
| 374 |
parent-titles)) |
| 375 |
(subtitles (select-elements exp-children (normalize "subtitle"))) |
| 376 |
(renderas (inherited-attribute-string (normalize "renderas") sect)) |
| 377 |
(hlevel ;; the apparent section level; |
| 378 |
(if renderas ;; if not real section level, |
| 379 |
(string->number ;; then get the apparent level |
| 380 |
(substring renderas 4 5)) ;; from "renderas", |
| 381 |
(SECTLEVEL))) |
| 382 |
(hs (HSIZE (- 4 hlevel)))) |
| 383 |
(make sequence |
| 384 |
(make paragraph |
| 385 |
font-family-name: %title-font-family% |
| 386 |
font-weight: (if (< hlevel 5) 'bold 'medium) |
| 387 |
font-posture: (if (< hlevel 5) 'upright 'italic) |
| 388 |
font-size: hs |
| 389 |
line-spacing: (* hs %line-spacing-factor%) |
| 390 |
space-before: (* hs %head-before-factor%) |
| 391 |
space-after: (if (node-list-empty? subtitles) |
| 392 |
(* hs %head-after-factor%) |
| 393 |
0pt) |
| 394 |
start-indent: (if (or (>= hlevel 3) |
| 395 |
(member (gi) (list (normalize "refsynopsisdiv") |
| 396 |
(normalize "refsect1") |
| 397 |
(normalize "refsect2") |
| 398 |
(normalize "refsect3")))) |
| 399 |
%body-start-indent% |
| 400 |
0pt) |
| 401 |
first-line-start-indent: 0pt |
| 402 |
quadding: %section-title-quadding% |
| 403 |
keep-with-next?: #t |
| 404 |
heading-level: (if %generate-heading-level% (+ hlevel 1) 0) |
| 405 |
|
| 406 |
; (if (and (equal? (gi sect) (normalize "refsect2")) |
| 407 |
; (equal? role "fu")) |
| 408 |
; (make sequence |
| 409 |
; (make external-graphic |
| 410 |
; entity-system-id: imgf |
| 411 |
; display?: #f |
| 412 |
; display-alignment: 'start) |
| 413 |
; (literal "\no-break-space;")) |
| 414 |
; (empty-sosofo)) |
| 415 |
(if (and (equal? (gi sect) (normalize "refsect2")) |
| 416 |
(equal? role "fu")) |
| 417 |
(make sequence |
| 418 |
font-weight: 'bold |
| 419 |
(literal "(" rev ")") |
| 420 |
(literal "\no-break-space;")) |
| 421 |
(empty-sosofo)) |
| 422 |
|
| 423 |
;; SimpleSects are never AUTO numbered...they aren't hierarchical |
| 424 |
(if (string=? (element-label (current-node)) "") |
| 425 |
(empty-sosofo) |
| 426 |
(literal (element-label (current-node)) |
| 427 |
(gentext-label-title-sep (gi sect)))) |
| 428 |
(element-title-sosofo (current-node))) |
| 429 |
(with-mode section-title-mode |
| 430 |
(process-node-list subtitles)) |
| 431 |
($section-info$ info)))) |
| 432 |
|
| 433 |
(element (appendix bibliography) |
| 434 |
(bibliography-content)) |
| 435 |
|
| 436 |
(define ($process-cell$ entry preventry row overhang) |
| 437 |
(let* ((colnum (cell-column-number entry overhang)) |
| 438 |
(lastcellcolumn (if (node-list-empty? preventry) |
| 439 |
0 |
| 440 |
(- (+ (cell-column-number preventry overhang) |
| 441 |
(hspan preventry)) |
| 442 |
1))) |
| 443 |
(lastcolnum (if (> lastcellcolumn 0) |
| 444 |
(overhang-skip overhang lastcellcolumn) |
| 445 |
0)) |
| 446 |
(font-name (if (have-ancestor? (normalize "thead") entry) |
| 447 |
%title-font-family% |
| 448 |
%body-font-family%)) |
| 449 |
(weight (if (have-ancestor? (normalize "thead") entry) |
| 450 |
'bold |
| 451 |
'medium)) |
| 452 |
(align (cell-align entry colnum)) |
| 453 |
(row (parent entry))) |
| 454 |
|
| 455 |
(make sequence |
| 456 |
;; This is a little bit complicated. We want to output empty cells |
| 457 |
;; to skip over missing data. We start count at the column number |
| 458 |
;; arrived at by adding 1 to the column number of the previous entry |
| 459 |
;; and skipping over any MOREROWS overhanging entrys. Then for each |
| 460 |
;; iteration, we add 1 and skip over any overhanging entrys. |
| 461 |
(let loop ((count (overhang-skip overhang (+ lastcolnum 1)))) |
| 462 |
(if (>= count colnum) |
| 463 |
(empty-sosofo) |
| 464 |
(make sequence |
| 465 |
($process-empty-cell$ count row) |
| 466 |
(loop (overhang-skip overhang (+ count 1)))))) |
| 467 |
|
| 468 |
;; Now we've output empty cells for any missing entries, so we |
| 469 |
;; are ready to output the cell for this entry... |
| 470 |
(make table-cell |
| 471 |
column-number: colnum |
| 472 |
n-columns-spanned: (hspan entry) |
| 473 |
n-rows-spanned: (vspan entry) |
| 474 |
|
| 475 |
cell-row-alignment: (cell-valign entry colnum) |
| 476 |
|
| 477 |
cell-after-column-border: (if (cell-colsep entry colnum) |
| 478 |
calc-table-cell-after-column-border |
| 479 |
#f) |
| 480 |
|
| 481 |
cell-after-row-border: (if (cell-rowsep entry colnum) |
| 482 |
(if (last-sibling? (parent entry)) |
| 483 |
calc-table-head-body-border |
| 484 |
calc-table-cell-after-row-border) |
| 485 |
#f) |
| 486 |
|
| 487 |
cell-before-row-margin: (if (equal? (attribute-string |
| 488 |
(normalize "role") |
| 489 |
row) |
| 490 |
"PE") |
| 491 |
0pt |
| 492 |
%cals-cell-before-row-margin%) |
| 493 |
cell-after-row-margin: (if (equal? (attribute-string |
| 494 |
(normalize "role") |
| 495 |
row) |
| 496 |
"PE") |
| 497 |
0pt |
| 498 |
%cals-cell-after-row-margin%) |
| 499 |
cell-before-column-margin: %cals-cell-before-column-margin% |
| 500 |
cell-after-column-margin: %cals-cell-after-column-margin% |
| 501 |
start-indent: %cals-cell-content-start-indent% |
| 502 |
end-indent: %cals-cell-content-end-indent% |
| 503 |
(if (equal? (gi entry) (normalize "entrytbl")) |
| 504 |
(make paragraph |
| 505 |
(literal "ENTRYTBL not supported.")) |
| 506 |
(make paragraph |
| 507 |
font-family-name: font-name |
| 508 |
font-weight: weight |
| 509 |
quadding: align |
| 510 |
(process-node-list (children entry)))))))) |
| 511 |
|
| 512 |
</style-specification-body> |
| 513 |
</style-specification> |
| 514 |
|
| 515 |
<external-specification id="docbook" document="docbook.dsl"> |
| 516 |
|
| 517 |
</style-sheet> |