File: frames.dsl

package info (click to toggle)
docbook-dsssl 1.79-6
  • links: PTS
  • area: main
  • in suites: lenny, squeeze
  • size: 3,256 kB
  • ctags: 27
  • sloc: perl: 496; xml: 126; makefile: 34
file content (131 lines) | stat: -rw-r--r-- 3,766 bytes parent folder | download | duplicates (13)
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
<!DOCTYPE style-sheet PUBLIC "-//James Clark//DTD DSSSL Style Sheet//EN" [
<!ENTITY docbook.dsl PUBLIC "-//Norman Walsh//DOCUMENT DocBook HTML Stylesheet//EN" CDATA DSSSL>
]>

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

(define %stylesheet-version%
  "Modular DocBook HTML Frames Stylesheet version 1.0")

(define %stylesheet% "docbook.css");

(root
 (make sequence
   (process-children)
   (with-mode manifest
     (process-children))
   (make-dhtml-toc)))

(define (make-dhtml-toc)
  (make entity
    system-id: "toc.htm"
    (make element gi: "HTML"
	  (make element gi: "HEAD"
		(make element gi: "TITLE" (literal "DocBook TOC"))
		($standard-html-header$)
		(make element gi: "SCRIPT"
		      attributes: '(("SRC" "docbook.js"))
		      (empty-sosofo)))
	  (make element gi: "BODY" 
		(make element gi: "DIV"
		      (with-mode dhtmltoc
			(process-children)))))))

(define (dhtml-toc-entry nd gilist)
  (let* ((subdivnodes (node-list-filter-by-gi (children nd) gilist))
	 (subdivs (and (> (node-list-length subdivnodes) 0)
		       (not (node-list=? nd (sgml-root-element)))))
	 (imgsrc  (if subdivs
		      "toc-plus.gif"
		      "toc-blank.gif"))
	 (imgatt  (list (list "SRC" imgsrc)
			(list "BORDER" "0")
			(list "ID" (string-append (generate-anchor) "IMG"))))
	 (span    (if subdivs
		      (make element gi: "SPAN"
			    attributes: (list 
					 (list "CLASS" "TOGGLE")
					 (list "onClick" 
					       (string-append 
						"toggleDiv('"
						(generate-anchor)
						"')")))
			    (make empty-element gi: "IMG"
				  attributes: imgatt))
		      (make element gi: "SPAN" 
			    attributes: '(("CLASS" "TOGGLE"))
			    (make empty-element gi: "IMG"
				  attributes: imgatt)))))
    (if (node-list=? nd (sgml-root-element))
	(make sequence
	  (make element gi: "NOBR"
		(make element gi: "SPAN"
		      attributes: (list ;(list "HREF" (href-to (current-node)))
					(list "onClick" (string-append 
							 "load_body(\""
							 (href-to (current-node))
							 "\")"))
					(list "CLASS" "TOCTITLE"))
		      (element-title-sosofo (current-node))))
	  (make element gi: "DIV"
		(process-children)))
	(make sequence
	  (make element gi: "NOBR"
		span
		(make element gi: "SPAN"
		      attributes: (list ;(list "HREF" (href-to (current-node)))
					(list "onClick" (string-append 
							 "load_body(\""
							 (href-to (current-node))
							 "\")"))
					(list "CLASS" "TOCTITLE"))
		      (element-title-sosofo (current-node))))
	  (make element gi: "DIV"
		attributes: (list (list "CLASS" "NAVTOC")
				  (list "ID" (generate-anchor)))
		(process-children))))))

(mode dhtmltoc
  (default (empty-sosofo))

  (element set (dhtml-toc-entry (current-node) 
				(list (normalize "book"))))

  (element book (dhtml-toc-entry (current-node) 
				 (list (normalize "part") 
				       (normalize "preface")
				       (normalize "chapter")
				       (normalize "appendix")
				       (normalize "reference"))))

  (element preface (dhtml-toc-entry (current-node) 
				    (list (normalize "sect1"))))

  (element part (dhtml-toc-entry (current-node)
				 (list (normalize "preface")
				       (normalize "chapter")
				       (normalize "appendix")
				       (normalize "reference"))))

  (element chapter (dhtml-toc-entry (current-node)
				    (list (normalize "sect1"))))

  (element appendix (dhtml-toc-entry (current-node)
				     (list (normalize "sect1"))))

  (element sect1 (dhtml-toc-entry (current-node) '()))

  (element reference (dhtml-toc-entry (current-node)
				      (list (normalize "refentry"))))
  
  (element refentry (dhtml-toc-entry (current-node) '()))
)

</style-specification-body>
</style-specification>

<external-specification id="docbook" document="docbook.dsl">

</style-sheet>