File: cstr.dssl

package info (click to toggle)
festival 1:2.5.0-3
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 7,508 kB
  • sloc: cpp: 27,915; lisp: 15,725; ansic: 6,022; sh: 5,683; java: 1,536; makefile: 753; xml: 291; perl: 87
file content (831 lines) | stat: -rw-r--r-- 23,228 bytes parent folder | download | duplicates (14)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
<!DOCTYPE style-sheet PUBLIC "-//James Clark//DTD DSSSL Style Sheet//EN" [
<!ENTITY dbstyle SYSTEM "/usr/local/share/sgml/stylesheets/docbook/html/docbook.dsl" CDATA DSSSL>
]>

<style-sheet>
<style-specification use="docbook">
<style-specification-body>

 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;;                                                                       ;;
 ;; CSTR modifications to modular docbook stylesheets. me of this could   ;;
 ;; perhaps be split into parameters and more parametarisable             ;;
 ;; definitions replaceing ones from the standard style sheets.           ;;
 ;;                                                                       ;;
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

(define html-index #t )

(define %shade-verbatim% #t)

(define %missing-link-error% #f)

(define image-directory "images_gen")

(define $generate-chapter-toc$ (lambda () #t))
(define %generate-book-toc% #f)

(define ($shade-verbatim-attr$)
  ;; Attributes used to create a shaded verbatim environment.
  (list
   (list "BORDER" "0")
   (list "WIDTH" "80%")))

(define ($shade-verbatim-cell-attr$)
  ;; Attributes used to create a shaded verbatim environment.
  (list
   ))

(define ($shade-verbatim-text-attr$)
  ;; Attributes used to create a shaded verbatim environment.
  (list
   (list "style" "white-space:pre; display:block;")
   (list "face" "monospace")
   (list "color" "#000000")
   ))

(define %body-attr% 
  ;; What attributes should be hung off of BODY?
  (list
   (list "BGCOLOR" "#FFFFFF")
   (list "BACKGROUND" "../cstr_background.jpg")
   (list "TEXT" "#0000AA")
	)
   )

(define $line-annotation-attr$
  ;; font attributes for line annotation
  (list
   (list "color" "#A00080")
   (list "size" "-1")
   (list "face" "sans")
   (list "weight" "bold")
   )
  )

(element lineannotation
	 (make element gi: "font"
	       attributes: $line-annotation-attr$
	       (process-children))
	 )

(element screen 
	(make element gi: "DIV" attributes: '(("ALIGN" "CENTER"))
		($verbatim-display$ %number-screen-lines%)
		)
	)

(element programlisting
	(make element gi: "DIV" attributes: '(("ALIGN" "CENTER"))
		($verbatim-display$ %number-programlisting-lines%)
		)
	)

(element sidebar 
	 (make element gi: "div"
	       (make empty-element gi: "br"
		     attributes: (list
				  (list "clear" "right")
				  )
		     )
	       (make element gi: "TABLE"
		     attributes: (list
				  (list "CLASS" (gi))
				  (list "BORDER" "1")
				  (list "CELLPADDING" "5"))
		     (make element gi: "TR"
			   (make element gi: "TD"
				 ($semiformal-object$))))
	       )
	 )

(define (default-header-nav-tbl-ff elemnode prev next prevsib nextsib)
  (let* ((r1? (nav-banner? elemnode))
	 (r1-sosofo (make element gi: "TR"
			  (make element gi: "TH"
				attributes: (list
					     (list "COLSPAN" "5")
					     (list "ALIGN" "center")
					     (list "VALIGN" "bottom"))
				(nav-banner elemnode))))
	 (r2? (or (not (node-list-empty? prev))
		  (not (node-list-empty? next))
		  (not (node-list-empty? prevsib))
		  (not (node-list-empty? nextsib))
		  (nav-context? elemnode)))
	 (r2-sosofo (make element gi: "TR"
			  (make element gi: "TD"
				attributes: (list
					     (list "WIDTH" "10%")
					     (list "ALIGN" "left")
					     (list "VALIGN" "top"))
				(if (node-list-empty? prev)
				    (make entity-ref name: "nbsp")
				    (make element gi: "A"
					  attributes: (list
						       (list "HREF" 
							     (href-to 
							      prev)))
					  (gentext-nav-prev prev))))
			  (make element gi: "TD"
				attributes: (list
					     (list "WIDTH" "10%")
					     (list "ALIGN" "left")
					     (list "VALIGN" "top"))
				(if (node-list-empty? prevsib)
				    (make entity-ref name: "nbsp")
				    (make element gi: "A"
					  attributes: (list
						       (list "HREF" 
							     (href-to 
							      prevsib)))
					  (gentext-nav-prevsib prevsib))))
			  (make element gi: "TD"
				attributes: (list
					     (list "WIDTH" "60%")
					     (list "ALIGN" "center")
					     (list "VALIGN" "bottom"))
				(nav-context elemnode))
			  (make element gi: "TD"
				attributes: (list
					     (list "WIDTH" "10%")
					     (list "ALIGN" "right")
					     (list "VALIGN" "top"))
				(if (node-list-empty? nextsib)
				    (make entity-ref name: "nbsp")
				    (make element gi: "A"
					  attributes: (list
						       (list "HREF" 
							     (href-to
							      nextsib)))
					  (gentext-nav-nextsib nextsib))))
			  (make element gi: "TD"
				attributes: (list
					     (list "WIDTH" "10%")
					     (list "ALIGN" "right")
					     (list "VALIGN" "top"))
				(if (node-list-empty? next)
				    (make entity-ref name: "nbsp")
				    (make element gi: "A"
					  attributes: (list
						       (list "HREF" 
							     (href-to
							      next)))
					  (gentext-nav-next next)))))))
    (if (or r1? r2?)
	(make element gi: "DIV"
	      attributes: '(("CLASS" "NAVHEADER"))
	  (make element gi: "TABLE"
		attributes: (list
			     (list "WIDTH" %gentext-nav-tblwidth%)
			     (list "BORDER" "0")
			     (list "CELLPADDING" "0")
			     (list "CELLSPACING" "0"))
		(if r1? r1-sosofo (empty-sosofo))
		(if r2? r2-sosofo (empty-sosofo)))
	  (make empty-element gi: "HR"
		attributes: (list
			     (list "ALIGN" "LEFT")
			     (list "WIDTH" %gentext-nav-tblwidth%)))
	  (make empty-element gi: "HR"
		attributes: (list
			     (list "ALIGN" "LEFT")
			     (list "WIDTH" %gentext-nav-tblwidth%))))
	(empty-sosofo))))

(define (default-header-nav-tbl-noff elemnode prev next prevsib nextsib)
  (let* ((r1? (nav-banner? elemnode))
	 (limg (entity-text "title-left-image"))
	 (rimg (entity-text "title-right-image"))
	 (r1-sosofo (make element gi: "TR"
			  (if limg 
			      (make element gi: "TH"
				    attributes: (list
						 (list "ROWSPAN" "2")
						 (list "ALIGN" "left"))
				    (make empty-element gi: "IMG"
					  attributes: (list
						       (list "SRC" limg)
						       )
					))
			      (empty-sosofo)
			      )
			  (make element gi: "TH"
				attributes: (list
					     (list "COLSPAN" "3")
					     (list "ALIGN" "center"))
				(nav-banner elemnode))
			  (if rimg 
			      (make element gi: "TH"
				    attributes: (list
						 (list "ROWSPAN" "2")
						 (list "ALIGN" "right"))
				    (make empty-element gi: "IMG"
					  attributes: (list
						       (list "SRC" rimg)
						       )
					))
			      (empty-sosofo)
			      )
			))
	 (r2? (or (not (node-list-empty? prev))
		  (not (node-list-empty? next))
		  (nav-context? elemnode)))
	 (r2-sosofo (make element gi: "TR"
			  (make element gi: "TD"
				attributes: (list
					     (list "WIDTH" "10%")
					     (list "ALIGN" "left")
					     (list "VALIGN" "bottom"))
				(if (node-list-empty? prev)
				    (make entity-ref name: "nbsp")
				    (make element gi: "A"
					  attributes: (list
						       (list "HREF" 
							     (href-to 
							      prev)))
					  (gentext-nav-prev prev))))
			  (make element gi: "TD"
				attributes: (list
					     (list "WIDTH" "80%")
					     (list "ALIGN" "center")
					     (list "VALIGN" "bottom"))
				(nav-context elemnode))
			  (make element gi: "TD"
				attributes: (list
					     (list "WIDTH" "10%")
					     (list "ALIGN" "right")
					     (list "VALIGN" "bottom"))
				(if (node-list-empty? next)
				    (make entity-ref name: "nbsp")
				    (make element gi: "A"
					  attributes: (list
						       (list "HREF" 
							     (href-to
							      next)))
					  (gentext-nav-next next)))))))
    (if (or r1? r2?)
	(make element gi: "DIV"
	      attributes: '(("CLASS" "NAVHEADER"))
	  (make element gi: "TABLE"
		attributes: (list
			     (list "WIDTH" %gentext-nav-tblwidth%)
			     (list "BORDER" "0")
			     (list "CELLPADDING" "0")
			     (list "CELLSPACING" "0"))
		(if r1? r1-sosofo (empty-sosofo))
		(if r2? r2-sosofo (empty-sosofo)))
	  (make empty-element gi: "HR"
		attributes: (list
			     (list "ALIGN" "LEFT")
			     (list "WIDTH" %gentext-nav-tblwidth%))))
	(empty-sosofo))))


(define ($verbatim-display$ line-numbers?)
  (let ((content (make element gi: "font"
				attributes: ($shade-verbatim-text-attr$)
		       (if line-numbers?
			   ($verbatim-content-with-linenumbers$)
			   ($verbatim-content$)))))
    (if %shade-verbatim%
	(make element gi: "TABLE"
	      attributes: ($shade-verbatim-attr$)
	      (make element gi: "TR"
		    (make element gi: "TD"
			  attributes: ($shade-verbatim-cell-attr$)
			  content
				)))
	content)))


(define ($sect-toc$)
  (let ((depth	(attribute-string "depth")))
    ;; Called by the TITLE element so that it can come after the TITLE
    (build-toc (ancestor-member (current-node) (section-element-list))
	       (if depth
		   (string->number depth)
		   (toc-depth (ancestor-member (current-node) (section-element-list)))
		   )
	       #t))
  )

(define ($chapter-toc$)
  (let ((depth	(attribute-string "depth")))
  ;; Called by the TITLE element so that it can come after the TITLE
  (build-toc (ancestor-member (current-node) (component-element-list))
	       (if depth
		   (string->number depth)
		   (toc-depth (ancestor-member (current-node) (component-element-list)))
		   )
	     #t)))

(element (SECT1 TOC)
	 (make element gi: "DIV"
	       (process-children)
	       ($sect-toc$)
	       )
	 )

(element (SECT2 TOC)
	 (make element gi: "DIV"
	       (process-children)
	       ($sect-toc$)
	       )
	 )

(element (SECT3 TOC)
	 (make element gi: "DIV"
	       (process-children)
	       ($sect-toc$)
	       )
	 )

(element (CHAPTER TOC)
	 (make element gi: "DIV"
	       (process-children)
	       ($chapter-toc$)
	       )
	 )

(element (BOOK TOC)
	 (make element gi: "DIV"
	       (process-children)
	       ($chapter-toc$)
	       )
	 )

;; Variable list

(element variablelist
  (make sequence
	(make element gi: "blockquote"
	      (make element gi: "table"
		    attributes: '(("class" "parameters"))
		    (process-children)))
	(para-check 'restart)))

(element (variablelist title)
	 (make element gi: "tr"
	       (make element gi: "th"
		     attributes: '(("colspan" "2") ("align" "left"))
		     (process-children))
	       )
	 )

(element varlistentry
  (let ((terms    (select-elements (children (current-node)) (normalize "term")))
	(listitem (select-elements (children (current-node)) (normalize "listitem"))))
    (make element gi: "tr"
	  attributes: '(("valign" "top"))
	  (make sequence
		(make element gi: "th"
		      attributes: '(("align" "right"))
		      (if (attribute-string (normalize "id"))
			  (make element gi: "A"
				attributes: (list (list "NAME" (attribute-string (normalize "id"))))
				(process-node-list terms))
			  (process-node-list terms)))
		(make element gi: "td"
		      (process-node-list listitem)
		      )
		)
	  )
    )
  )
  
(element (varlistentry term)
  (make sequence
    (process-children-trim)
    (if (not (last-sibling?))
	(literal ", ")
	(literal ""))))

(element (varlistentry listitem)
	(process-children))


;; by copy of the index building stuff.

(define (htmlindexattr-inherited attr)
  (if (inherited-attribute-string (normalize attr))
      (make sequence
	(make formatting-instruction data: attr)
	(make formatting-instruction data: " ")
	(make formatting-instruction data: (inherited-attribute-string 
					    (normalize attr)))
	(htmlnewline))
      (empty-sosofo)))

(mode htmlindex
  ;; this mode is really just a hack to get at the root element
  (root (process-children))

  (default 
    (if (node-list=? (current-node) (sgml-root-element))
	(make entity
	  system-id: (html-entity-file html-index-filename)
	  (process-node-list (select-elements 
			      (descendants (current-node))
			      (normalize "indexterm"))))
	(empty-sosofo)))

  (element indexterm
    (let* ((target (ancestor-member (current-node)
				    (append (book-element-list)
					    (division-element-list)
					    (component-element-list)
					    (section-element-list))))
	   (title  (string-replace (element-title-string target) "&#13;" " ")))
      (make sequence
	(make formatting-instruction data: "INDEXTERM ")
	(make formatting-instruction data: (href-to target))
	(htmlnewline)

	(make formatting-instruction data: "INDEXPOINT ")
	(make formatting-instruction data: (href-to (current-node)))
	(htmlnewline)

	(make formatting-instruction data: "TITLE ")
	(make formatting-instruction data: title)
	(htmlnewline)

	(htmlindexattr "scope")
	(htmlindexattr "significance")
	(htmlindexattr "class")
	(htmlindexattr-inherited "id")
	(htmlindexattr "startref")
	
	(if (attribute-string (normalize "zone"))
	    (htmlindexzone (attribute-string (normalize "zone")))
	    (empty-sosofo))

	(process-children)

	(make formatting-instruction data: "/INDEXTERM")
	(htmlnewline))))
		    
  (element primary
    (htmlindexterm))

  (element secondary
    (htmlindexterm))

  (element tertiary
    (htmlindexterm))

  (element see
    (htmlindexterm))

  (element seealso
    (htmlindexterm))
)

;; TeX processing support
(define html-tex-filename
	"TeX.formulae"
	)

(define (tex-graphic #!optional (nd (current-node)))
  (let* ((format (attribute-string "format" nd))
	 (fileref (attribute-string "fileref" nd))
	 )
    (if (equal? format (normalize "tex"))
	(make sequence
	      (make formatting-instruction data: "@Name ")
	      (make formatting-instruction data: (string-append image-directory "/" fileref))
	      (htmlnewline)
	      (make formatting-instruction data: "@Start")
	      (htmlnewline)
	      (make formatting-instruction data: (data nd))
	      (htmlnewline)
	      (make formatting-instruction data: "@End")
	      (htmlnewline)
	      )
	(empty-sosofo)
	)
    )
  )

(define ($img$ #!optional (nd (current-node)) (alt #f))
  ;; This function now supports an extension to DocBook.  It's
  ;; either a clever trick or an ugly hack, depending on your
  ;; point of view, but it'll hold us until XLink is finalized
  ;; and we can extend DocBook the "right" way.
  ;;
  ;; If the entity passed to GRAPHIC has the FORMAT
  ;; "LINESPECIFIC", either because that's what's specified or
  ;; because it's the notation of the supplied ENTITYREF, then
  ;; the text of the entity is inserted literally (via Jade's
  ;; read-entity external procedure).
  ;;
  (let* ((fileref   (attribute-string (normalize "fileref") nd))
         (entityref (attribute-string (normalize "entityref") nd))
         (format    (if (attribute-string (normalize "format") nd)
                        (attribute-string (normalize "format") nd)
                        (if entityref
                            (entity-notation entityref)
                            #f)))
         (align     (attribute-string (normalize "align") nd)))
    (if (or fileref entityref)
        (if (equal? format (normalize "linespecific"))
            (if fileref 
                (include-file fileref)
                (include-file (entity-generated-system-id entityref)))
	    (if (equal? format (normalize "tex"))
		(if fileref 
		    ($graphic$ (string-append image-directory "/" fileref) format alt align)
		    ($graphic$ (string-append image-directory "/" (system-id-filename entityref))
			       format alt align))
		(if fileref
		    ($graphic$ fileref format alt align)
		    ($graphic$ (system-id-filename entityref)
			       format alt align)))
	    )
	(empty-sosofo)
	)))

(mode tex-graphics
      ;; this mode is really just a hack to get at the root element
      (root (process-children))
      
      (default 
	(if (node-list=? (current-node) (sgml-root-element))
	    (make entity
		  system-id: (html-entity-file html-tex-filename)
		  (process-node-list (select-elements 
				      (descendants (current-node))
				      (normalize "graphic")))
		  (process-node-list (select-elements 
				      (descendants (current-node))
				      (normalize "inlinegraphic")))
		  )
	    (empty-sosofo)))
      
      (element graphic
	       (tex-graphic)
	       )

      (element inlinegraphic
	       (tex-graphic)
	       )

      )

(root
 (make sequence
;   (literal
;    (debug (node-property 'gi
;                         (node-property 'document-element (current-node)))))
;(define (docelem node)
;  (node-propety 'document-element 
;    (node-property 'grove-root node)))
   (process-children)
   (with-mode manifest
     (process-children))
   (if html-index
       (with-mode htmlindex
         (process-children))
       (empty-sosofo))
   (with-mode tex-graphics
	      (process-children)
	      )
   )
 )

;; Sections can pass on role information

(define ($section-body$)
  (let* ((sect (current-node))
	 (class (or (attribute-string "ROLE" sect)
		    (gi sect)
		    )
		  )
	 )
    (make element gi: "DIV"
	  attributes: (list (list "CLASS" class))
	  ($section-separator$)
	  ($section-title$)
	  (if (equal? class "entry") 
	      (make element gi: "blockquote"
		    (process-children)
		    )
	      (process-children)
	      )
	  )
    )
  )

(define ($section-title$)
  (let* ((sect (current-node))
	 (info (info-element))
	 (subtitles (select-elements (children info) (normalize "subtitle")))
	 (renderas (inherited-attribute-string (normalize "renderas") sect))
	 (hlevel                          ;; the apparent section level;
	  (if renderas                    ;; if not real section level,
	      (string->number             ;;   then get the apparent level
	       (substring renderas 4 5))  ;;   from "renderas",
	      (SECTLEVEL)))               ;; else use the real level
	 (h1elem
	  (string-append "H" (number->string hlevel)))
	 (h2elem
	  (string-append "H" (number->string (+ hlevel 1))))
	 (name (element-id))
	 (isep (gentext-intra-label-sep (gi sect)))
	 (nsep (gentext-label-title-sep (gi sect)))
	 (role (attribute-string "ROLE" sect))
	 (h1class (if role (string-append (gi sect) "" role) (gi sect)))
	 )
    (make sequence
	      (make element gi: h1elem
		    attributes: (list (list "CLASS" h1class))
		    (make element gi: "A"
			  attributes: (list (list "NAME" name))
			  (if (string=? (element-label (current-node)) "")
			      (empty-sosofo)
			      (literal (element-label (current-node)) nsep))
			  (element-title-sosofo sect)
			  ))
	  (if (node-list-empty? subtitles) 
	      (empty-sosofo)
	      (with-mode subtitle-mode
			 (make element gi: h2elem
			       attributes: (list (list "CLASS" (string-append h1class "-subtitle")))
						 (process-node-list subtitles))))
	      ($proc-section-info$ info))))


(define %html-header-tags%
  '(
    ("link" ("rel" "stylesheet") ("type" "text/css") ("href" "cstrdoc.css"))
    )
  )


(element synopsis
	 (make element gi: "table"
	       attributes: '(("cellspacing" "0")("cellpadding" "0") ("class" "synopsys"))
	       (make element gi: "tr"
		     (make sequence
			   (make element gi: "td"
				 attributes: '(("valign" "top"))
				 (with-mode synopsis-table (process-matching-children '("synopsis" ("role" "type"))))
				 )
			   (make element gi: "td"
				 attributes: '(("valign" "top"))
				 (with-mode synopsis-table (process-matching-children '("synopsis" ("role" "name"))))
				 )

			   (with-mode synopsis-table-args (process-matching-children '("synopsis" ("role" "args"))))
			   )
		     )
	       )
	 )

(mode synopsis-table-args
      
      (element synopsis 
	       (let* ((role (attribute-string "role"))
		      (children (children (current-node)))
		      (start (if (node-list-empty? children)
				 ""
				 (data (node-list-first children))))
		      )
		 (if (and (string? start) (not (string=? start "")))
		     (make sequence
			   (make element gi: "td"
				 attributes: '(("valign" "top"))
				 (make element gi: "tt"
				       (literal "(")
				       )
				 )
			   (make element gi: "td"
				 attributes: '(("valign" "top"))
				 (make element gi: "tt"
				       (if (and (equal? role "args") 
						(string? start) 
						(not (string=? start "")) 
						(equal? (substring start 0 1) "(")
						)
					   (make sequence
						 (literal (substring start 1 (string-length start)))
						 (process-node-list (node-list-rest children))
						 )
					   (process-children)
					   )
				       )
				 )
			   )
		     (empty-sosofo)
		     )
		 )
	       )
      )

(mode synopsis-table
      
      (element synopsis 
	       (make element gi: "tt"
		     (let* ((role (attribute-string "role"))
			    (children (children (current-node)))
			    (start (if (node-list-empty? children)
				       ""
				       (data (node-list-first children))))
			    )
		       (if (and (equal? role "args") 
				(string? start) 
				(not (string=? start "")) 
				(equal? (substring start 0 1) "(")
				)
			   (make sequence
				 (literal (substring start 1 (string-length start)))
				 (process-node-list (node-list-rest children))
				 )
			   (process-children)
			   )
		       )
		 )
	       )
      )

(element link
  (let* ((endterm (attribute-string (normalize "endterm")))
	 (linkend (attribute-string (normalize "linkend")))
	 (target  (element-with-id linkend))
	 (etarget (if endterm 
		      (element-with-id endterm)
		      (empty-node-list))))
    (if (node-list-empty? target) 
	(if %missing-link-error%
	    (error (string-append "Link to missing ID '" linkend "'"))
	    (make element gi: "font"
		  attributes: '(("color" "green"))
		  (process-children)
		  )
	    )
	(make sequence
	      (if (and endterm (node-list-empty? etarget))
		  (error (string-append "EndTerm to missing ID '" endterm "' on Link"))
		  (empty-sosofo))
	      (make element gi: "A"
		    attributes: (list (list "HREF" (href-to target)))
		    (if endterm
			(with-mode xref-endterm-mode (process-node-list etarget))
			(process-children)))))))


(element formalpara
  (make element gi: "DL"
	attributes: (list
		     (list "CLASS" (gi)))
	(make element gi: "dt"
	      (process-children))))

(element (formalpara title) 
	 (make element gi: "DT"
	       (make element gi: "strong"
		     (process-children)))
	 )

(element (formalpara para)
	 (make element gi: "DD"
	       (process-children)))

(element filename
	 (make element gi: "TT"
	       	attributes: '(("CLASS" "filename"))
	       (process-children))
	 )

(define (chunk? #!optional (nd (current-node)))
  ;; 1. The (sgml-root-element) is always a chunk.
  ;; 2. If nochunks is #t or the dbhtml PI on the root element 
  ;;    specifies chunk='no', then the root element is the only
  ;;    chunk.
  ;; 3. Otherwise, elements in the chunk-element-list are chunks
  ;;    unless they're combined with their parent.
  ;; 3a. Things tagged with `newpage' are chunks.
  ;; 4. Except for bibliographys, which are only chunks if they
  ;;    occur in book.
  ;;    
  (let ((maybechunk (or (not (equal? (gi nd) (normalize "bibliography")))
			(equal? (gi (parent nd)) (normalize "book")))))
    (if (node-list=? nd (sgml-root-element))
	#t
	(if (or nochunks
		(equal? (dbhtml-value (sgml-root-element) "chunk") "no"))
	    #f
	    (if (member (gi nd) (chunk-element-list))
		(if (combined-chunk? nd)
		    #f
		    maybechunk)
		(if (attribute-string "newpage" nd) 
		    maybechunk
		    #f))))))


</style-specification-body>
</style-specification>
<external-specification id="docbook" document="dbstyle">
</style-sheet>