File: dd2xml.html

package info (click to toggle)
debiandoc2dbxml 0.2
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k, lenny
  • size: 104 kB
  • ctags: 12
  • sloc: xml: 386; sh: 218; makefile: 66
file content (597 lines) | stat: -rw-r--r-- 12,626 bytes parent folder | download | duplicates (3)
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
<html>
<head>
   <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
   <meta name="Author" content="Osamu Aoki">
   <meta name="GENERATOR" content="VIM">
   <title>debiandoc-sgml to docbook-xml conversion</title>
</head>
<body>
<h1>debiandoc-sgml to docbook-xml conversion</h1>
<pre>
==========================================================================
        (original concept) Philippe Batailler &lt;pbatailler@teaser.fr&gt;
        (original concept) Adam DiCarlo       &lt;aph@debian.org&gt;
        (ghost writer) Osamu Aoki             &lt;osamu@debian.org&gt;
                                                  Sat Dec 14 00:54:21 2002
==========================================================================
</pre>
</p>

<h2><a name="toc">Table of contents</a></h2>
<p>
<ul>
<li><a href="#why">Why convert?</a></li>
<li><a href="#how">How to read this?</a></li>
<li><a href="#step">Step by step guide.</a></li>
<li><a href="#tags">How tags are converted?</a></li>
</ul>
</p>
<hr>

<h2><a name="why">Why convert?</a></h2>
<p>
Because it is cool to be XML :)
</p>
<hr>

<h2><a name="how">How to read this?</a></h2>
<p>
Use table capable web browser if you are reading HTML.
</p>
<ul>
 <li>Mozilla</li>
 <li>Galeon</li>
 <li>links</li>
 <li>w3m</li>
 <li>...</li>
</ul>
<hr>

<h2><a name="step">Step by step guide.</a></h2>
<p>
This is a rehashed tutorial given by Philippe Batailler's to Osamu Aoki
through the private e-mails in 2002.
</p>
<p>
In order to convert debiandoc-sgml into docbook-xml, following
steps needs to be taken:
</p>

<p>
<ol>
<li>Install debiandoc2dbxml
<!--
<p>
Get a file <tt>Debiandoc2dbxml.tar.gz</tt> from 
<a href="http://www.teaser.fr/~pbatailler/">Philippe Batailler's web site</a>.
Then untar it and copy contents to the root of SGML file source.
</p>
<p>
Note: Something like following should work once this is packaged into deb.
<pre>
$ su -c "apt-get update && apt-get install ???debian2docbookxml???"
</pre>
</p>
<p>
Get scripts from DDP CVS server
<pre>
$ cd $HOME
$ echo 'export PATH="~/Debiandoc-to-docbook:${PATH}"'>> ~/.bash_profile
$ . ~/.bash_profile
$ export CVSROOT=:pserver:anonymous@cvs.debian.org:/cvs/debian-doc
$ cvs login
$ cvs co -d Debiandoc-to-docbook utils/debiandoc-to-docbook # ***
$ cd Debiandoc-to-docbook
$ make
$ cd /some/debiandoc/sgml/source-directory/   # use of mc is easy way :)
</pre>
***) Whoever checked out from old CVS location, please commit all
changes and check out all new trees in a different location.
I will remove old CVS location soon.
</p>
-->
<li>Make source file compatible with script manually
<p>
Due to some conversion script limitations, if you experience problems
converting files, please consider the following source touch-up rules
presented below, although script might have fixed some of the issues 
already (it will not harm).
</p>
<ul>
<li>Adjust SGML header lines (first few lines of the file)
<p>If foo.sgml includes many files (subset of dtd), first line must end 
with [ as:
<pre>
&lt;!DOCTYPE debiandoc PUBLIC "-//DebianDoc//DTD DebianDoc//EN" [
... content
]&gt;
</pre>
Here splitting each start and end of these section will fail.
</p>
<p>
If foo.sgml is a single file, header is:
<pre>
&lt;!DOCTYPE debiandoc  PUBLIC "-//DebianDoc//DTD DebianDoc//EN"&gt;
</pre>
</p>

<li>Keep some conditionals within one line.
<p>
<pre>
&lt;[%bar;[
</pre>
</p>

<li>Keep some some tags within one line.
<p>
<pre>
&lt;chapt&gt;...&lt;/chapt&gt;
&lt;appendix&gt;...&lt;/appendix&gt;
&lt;sect&gt;...&lt;/sect&gt;
&lt;sect1&gt;...&lt;/sect1&gt;
&lt;sect2&gt;...&lt;/sect2&gt;
</pre>
</p>

<li>Remove some comment
<p>
<pre>
&lt;!-- ... --&gt;
</pre>
</p>
<p>
This is to avoid script to malfunction by "<tt> ]&gt; </tt>" in the comment.
</p>

<li>make attribute such as "id" a single token.
<p>
<pre>
wrong:   &lt;book id="foo bar"&gt;
correct: &lt;book id="foo_bar"&gt;
</pre>
</p>

</ul>
</p>

<li>Normalize SGML to XML compatible format (debiandoc-tidy)
<p>
<pre>
$ debiandoc-tidy foo.sgml
$ debiandoc-tidy -e bar.ent
</pre>
</p>

<li>Convert SGML tags into XML tags (debiandoc2dbxml)
<p>
If foo.sgml is smaller article in a single file without subset of dtd.
<pre>
$ debiandoc2dbxml -a path/to/foo.sgml
</pre>
</p>
<p>
If foo.sgml is larger book in a single file without subset of dtd.
<pre>
$ debiandoc2dbxml -b path/to/foo.sgml
</pre>
</p>
<p>
If foo.sgml is larger book with many included files (subset of dtd).
<pre>
$ debiandoc2dbxml -s -b path/to/foo.sgml
</pre>
</p>
<p>
Now we have got a large single foo.xml
</p>
<p>
If foo.sgml is larger book with many included files (subset of dtd). To 
create split file output in directory path/to/locale, you should use the
option -S and the option -l (locale = en, fr, es...)
<pre>
$ debiandoc2dbxml -S -s -b -l fr path/to/foo.sgml
</pre>
</p>
<p>
Now we have got a foo.xml in <tt>path/to/</tt> with many chunks of files 
under <tt>path/to/fr/</tt>
</p>
<p>
For debugging, use "-k" to keep intermediate files and use 
"-t" to trace shell activities.
</p>

<li>Test it with emacs and psgml, or nsgmls:
<p>
<pre>
$ nsgmls -s /usr/share/sgml/declaration/xml.decl foo.xml
</pre>
<li>Format source for readability
<p>
In order to make source more readable, some reformatting may be good idea.
For example, to add newline after &lt;/listitem&gt;:
<pre>
$ perl -i -p -e's,&lt;/listitem&gt;,&lt;/listitem&gt;\n,g' foo.xml
</pre>
</p>

<li>Building output
<p>
There are few strategies to build output.
<table border="1">
<tr>
 <td>
  Stylesheet
 </td>
 <td>
  Back end
 </td>
</tr>
<tr>
 <td>DSSSL</td>
 <td>jade and jadetex</td>
</tr>
<tr>
 <td>CSS</td>
 <td>mozilla?</td>
</tr>
<tr>
 <td>XSL</td>
 <td>passivetex?</td>
</tr>
</table>
<p>
Needs more documentation for creating files (plain text, multi-file, 
HTML, PS, PDF).
</p>
</ol>
</p>
<hr>
<h2><a name="tags">How tags are converted?</a></h2>
<p>
Here is a conversion list of tags from debiandoc-sgml to dookbook-xml. 
Each column means as follows:

<ul>
 <li>"debiandoc-sgml tag" are the tags used in original documents.</li>
 <li>"converted docbook-xml tag" are the tags converted programatically 
 by XLST.</li>
 <li>"alternative docbook-xml tag" are the alternative tags which may 
 be used in places by editing dookbook-xml source later by the human.</li>
</ul>
</p>

<table border="1">
 <tr>
  <td><p>original debiandoc-sgml tag</p></td>
  <td><p>converted docbook-xml tag using XLST</p></td>
  <td><p>alternative docbook-xml tag</p></td>
 </tr>
 <tr>
  <td><p>book</p></td>
  <td>
   <p>book (-b option)</p>
   <p>article (-a option)</p>
  </td>
  <td><p></p></td>
 </tr>
 <tr>
  <td><p>title</p></td>
  <td><p>title</p></td>
  <td><p></p></td>
 </tr>
 <tr>
  <td><p>author</p></td>
  <td><p>author</p></td>
  <td><p></p></td>
 </tr>
 <tr>
  <td><p>name</p></td>
  <td><p>firstname + surname</p></td>
  <td><p></p></td>
 </tr>
 <tr>
  <td><p>email</p></td>
  <td>
   <p>affiliation + address + email (in author element)</p>
   <p>email (other places)</p></td>
  </td>
  <td><p></p></td>
 </tr>
 <tr>
  <td><p>version</p></td>
  <td><p>releaseinfo</p></td>
  <td><p></p></td>
 </tr>
 <tr>
  <td><p>abstract</p></td>
  <td><p>abstract + para</p></td>
  <td><p></p></td>
 </tr>
 <tr>
  <td><p>copyright</p></td>
  <td><p>copyright</p></td>
  <td><p></p></td>
 </tr>
 <tr>
  <td><p>toc</p></td>
  <td>
   <p>(presentation tool takes care)</p>
   <p>(stylesheet is needed?) (oa)</p>
  </td>
  <td><p></p></td>
 </tr>
 <tr>
  <td><p>chapt</p></td>
  <td>
   <p>chapter (-b option)</p>
   <p>section (-a option)</p>
  </td>
  <td><p></p></td>
 </tr>
 <tr>
  <td><p>appendix</p></td>
  <td><p>appendix</p></td>
  <td><p></p></td>
 </tr>
 <tr>
  <td><p>sect</p></td>
  <td><p>section</p></td>
  <td><p></p></td>
 </tr>
 <tr>
  <td><p>sect1</p></td>
  <td><p>section</p></td>
  <td><p></p></td>
 </tr>
 <tr>
  <td><p>sect2</p></td>
  <td><p>section</p></td>
  <td><p></p></td>
 </tr>
 <tr>
  <td><p>sect3</p></td>
  <td><p>section</p></td>
  <td><p></p></td>
 </tr>
 <tr>
  <td><p>sect4</p></td>
  <td><p>section</p></td>
  <td><p></p></td>
 </tr>
 <tr>
  <td><p>p</p></td>
  <td><p>para</p></td>
  <td><p></p></td>
 </tr>
 <tr>
  <td><p>em</p></td>
  <td><p>emphasis</p></td>
  <td><p></p></td>
 </tr>
 <tr>
  <td><p>strong</p></td>
  <td>
   <p>emphasis role="strong" (aph)</p>
   <p>emphasis role="bold" (pb)</p>
  </td>
  <td><p>emphasis role="important"</p></td>
 </tr>
 <tr>
  <td><p>var</p></td>
  <td><p>replaceable</p></td>
  <td><p></p></td>
 </tr>
 <tr>
  <td><p>package</p></td>
  <td><p>systemitem role="package"</p></td>
  <td><p></p></td>
 </tr>
 <tr>
  <td><p>prgn</p></td>
  <td><p>command</p></td>
  <td><p>??? (what to use for well known file w/o path)</p></td>
 </tr>
 <tr>
  <td><p>file</p></td>
  <td><p>filename</p><p>filename class="directory" (if it end with /)</p></td>
  <td><p>filename class="directory"</p></td>
 </tr>
 <tr>
  <td><p>tt</p></td>
  <td><p>literal</p></td>
  <td>
   <p>command (this should have been prgn but many documents do this)</p>
   <p>constant</p>
   <p>computeroutput</p>
   <p>envar</p>
   <p>function</p>
   <p>keycap</p>
   <p>keycode</p>
   <p>keycombo</p>
   <p>keysym</p>
   <p>markup</p>
   <p>option</p>
   <p>parameter</p>
   <p>prompt</p>
   <p>property</p>
   <p>returnvalue</p>
   <p>sgmltag</p>
   <p>symbol</p>
   <p>token</p>
   <p>userinput</p>
   <p>varname</p>
   <p>wordasword</p>
   <p>(do we need all these? are all in docbook-simple?</p>
 </tr>
 <tr>
  <td><p>qref</p></td>
  <td><p>link</p></td>
  <td><p>citation ?</p></td>
 </tr>
 <tr>
  <td><p>ref</p></td>
  <td>
   <p>xref  (empty element)</p>
  </td>
  <td><p></p></td>
 </tr>
 <tr>
  <td><p>manref</p></td>
  <td><p>citerefentry + refentrytitle + manvolnum</p></td>
  <td><p></p></td>
 </tr>
 <tr>
  <td><p>ftpsite (old)</p></td>
  <td><p>(convert original tag to url in debiandoc source)</p></td>
  <td><p></p></td>
 </tr>
 <tr>
  <td><p>ftppath (old)</p></td>
  <td><p>(convert original tag to url in debiandoc source)</p></td>
  <td><p></p></td>
 </tr>
 <tr>
  <td><p>httpsite (old)</p></td>
  <td><p>(convert original tag to url in debiandoc source)</p></td>
  <td><p></p></td>
 </tr>
 <tr>
  <td><p>httppath (old)</p></td>
  <td><p>(convert original tag to url in debiandoc source)</p></td>
  <td><p></p></td>
 </tr>
 <tr>
  <td><p>url</p></td>
  <td><p>ulink</p></td>
  <td><p></p></td>
 </tr>
 <tr>
  <td><p>footnote</p></td>
  <td><p>footnote</p></td>
  <td><p></p></td>
 </tr>
 <tr>
  <td><p>list</p></td>
  <td><p>itemizedlist</p></td>
  <td><p></p></td>
 </tr>
 <tr>
  <td><p>list compact</p></td>
  <td><p>itemizedlist spacing="compact"</p></td>
  <td><p></p></td>
 </tr>
 <tr>
  <td><p>enumlist</p></td>
  <td><p>orderedlist</p></td>
  <td><p></p></td>
 </tr>
 <tr>
  <td><p>enumlist compact</p></td>
  <td><p>orderedlist spacing="compact"</p></td>
  <td><p></p></td>
 </tr>
 <tr>
  <td><p>taglist</p></td>
  <td><p>variablelist</p></td>
  <td><p></p></td>
 </tr>
 <tr>
  <td><p>taglist compact</p></td>
  <td><p>variablelist (there is no "spacing" attribute)</p></td>
  <td><p>(possibly converting to table)</p></td>
 </tr>
 <tr>
  <td><p>item</p></td>
  <td><p>listitem + para</p></td>
  <td><p></p></td>
 </tr>
 <tr>
  <td><p>tag</p></td>
  <td><p>varlistentry + term</p></td>
  <td><p></p></td>
 </tr>
 <tr>
  <td><p>example</p></td>
  <td><p>screen</p></td>
  <td>
    <p>literallayout class="monospaced"</p>
    <p></p>
  </td>
 </tr>
 <tr>
  <td><p>heading</p></td>
  <td><p>title</p></td>
  <td><p></p></td>
 </tr>
 <tr>
  <td><p>comment</p></td>
  <td><p>remark</p></td>
  <td>
   <p>caution</p>
   <p>tip</p>
   <p>warning</p>
   <p>note</p>
  </td>
 </tr>
 <tr>
  <td><p>comment/p</p></td>
  <td><p>phrase</p></td>
  <td><p></p></td>
 </tr>

 <tr>
  <td><p>*HTML* (table)</p></td>
  <td><p></p></td>
  <td><p></p></td>
 </tr>

 <tr>
  <td><p>*HTML* (tr)</p></td>
  <td><p></p></td>
  <td><p></p></td>
 </tr>

 <tr>
  <td><p>*HTML* (th)</p></td>
  <td><p></p></td>
  <td><p></p></td>
 </tr>

 <tr>
  <td><p>*HTML* (td)</p></td>
  <td><p></p></td>
  <td><p></p></td>
 </tr>

 <tr>
  <td><p>*HTML* (img src)</p></td>
  <td><p></p></td>
  <td><p></p></td>
 </tr>

 <tr>
  <td><p>?</p></td>
  <td><p></p></td>
  <td><p></p></td>
 </tr>

</table>

<p>
Here <strong>*HTML*</strong> entries above is not real tags in 
debiandoc-sgml but tags of the missing feature to create 
corresponding HTML tags.
</p>

<p>
file splitting is has funny bug which create titletoc.xml in scripts
directory.  Also, multi file XML requires entries like:
<pre>
&lt;!ENTITY titletoc       SYSTEM "en/titletoc.sgml"&gt;
</pre>
Currently, this is manual process.
</p>

</body>
</html>