-
Notifications
You must be signed in to change notification settings - Fork 25
/
howto.xml
2291 lines (2062 loc) · 87.1 KB
/
howto.xml
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
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<?xml version="1.0" encoding="utf-8"?> <!-- -*- nxml -*- -->
<!DOCTYPE article [
<!ENTITY version "5.0">
<!ENTITY yes "<phrase role='unicode yes'>✔</phrase>">
<!ENTITY no "<phrase role='unicode no'>✘</phrase>">
]>
<article xmlns="http://docbook.org/ns/docbook"
xmlns:xl="http://www.w3.org/1999/xlink"
version="5.0" xml:lang="en">
<info>
<title>DocBook V5.0</title>
<subtitle>The Transition Guide</subtitle>
<authorgroup>
<author><personname>Jirka Kosek</personname>
<email>[email protected]</email></author>
<author><personname>Norman Walsh</personname>
<email>[email protected]</email>
<contrib>§convert4to5, proofreading</contrib></author>
<author><personname>Dick Hamilton</personname>
<email>[email protected]</email>
<contrib>§changes-removed, customization, proofreading</contrib></author>
<othercredit
class="other"
otherclass="contributor"
><personname>Michael(tm) Smith</personname>
<email>[email protected]</email>
<contrib>§dbxsl-ns</contrib>
</othercredit>
</authorgroup>
<pubdate>2009-06-16</pubdate>
<pubdate>2008-02-06</pubdate>
<pubdate>2007-10-28</pubdate>
<pubdate>2006-10-22</pubdate>
<pubdate>2006-05-16</pubdate>
<pubdate>2006-03-01</pubdate>
<pubdate>2005-12-28</pubdate>
<pubdate>2005-10-27</pubdate>
</info>
<para>This document is targeted at DocBook users who are considering
switching from DocBook V4.x to DocBook V5.0. It describes
differences between DocBook V4.x and V5.0 and provides some suggestions about
how to edit and process DocBook V5.0 documents. There is
also a section devoted to conversion of legacy documents from DocBook
4.x to DocBook V5.0.</para>
<para>At the time this was written the current version of DocBook V5.0
was &version;. However, almost all of the information in this document is
general and applies to any newer version of DocBook V5.0.
</para>
<section xml:id="introduction">
<title>Introduction</title>
<para>The differences between DocBook V4.x and V5.0 are quite radical in
some aspects, but the basic idea behind DocBook is still the same, and
almost all element names are unchanged. Because of this it is very
easy to become familiar with DocBook V5.0 if you know any previous version of
DocBook. You can find a complete list of changes in
<citation>DB5SPEC</citation>, here we will discuss only the most
fundamental changes.</para>
<section xml:id="introduction-ns">
<title>Finally in a namespace</title>
<para>All DocBook V5.0 elements are in the namespace
<uri>http://docbook.org/ns/docbook</uri>. <acronym>XML<alt>Extensible
Markup Language</alt></acronym> namespaces are used to distinguish
between different element sets. In the last few years, almost all new
XML grammars have used their own namespace. It is easy to
create compound documents that contain elements from different XML
vocabularies. DocBook V5.0 is following this design rule. Using
namespaces in your documents is very easy. Consider this
simple article marked up in DocBook V4.5:</para>
<programlisting><![CDATA[<article>
<title>Sample article</title>
<para>This is a really short article.</para>
</article>]]></programlisting>
<para>The corresponding DocBook V5.0 article will look very similar:</para>
<programlisting><![CDATA[<article xmlns="http://docbook.org/ns/docbook" …>
<title>Sample article</title>
<para>This is a really short article.</para>
</article>]]></programlisting>
<para>The only change is the addition of a default namespace declaration
(<code>xmlns="http://docbook.org/ns/docbook"</code>) on the root
element. This declaration applies the namespace to the root element and
all nested elements. Each
element is now uniquely identified by its local name and namespace.</para>
<note>
<para>The namespace name <uri>http://docbook.org/ns/docbook</uri> serves
only as an identifier. This resource is not fetched during processing
of DocBook documents, and you are not required to have an Internet
connection during processing. If you access the namespace URI with a browser,
you will find a short explanatory document about the namespace. In the
future this document will probably conform to (some version of) RDDL
and provide pointers to related resources.</para>
</note>
</section>
<section xml:id="introduction-rng">
<title>Relaxing with DocBook</title>
<para>For more than a decade, the DocBook schema was defined using a
DTD. However, DTDs have serious limitations, and DocBook V5.0 is thus
defined using a very powerful schema language called RELAX NG. Thanks
to RELAX NG, it is now much easier to create customized versions of
DocBook, and some content models are now cleaner and more
precise.</para>
<para>Using RELAX NG has an impact on the document prolog. The following
example shows the typical prolog of a DocBook V4.x document. The version of
the DocBook DTD (in this case 4.5) is indicated in the document type
declaration (!DOCTYPE) which points to a particular version of the
DTD.</para>
<example xml:id="ex.docbook45">
<title>DocBook V4.5 document</title>
<programlisting><![CDATA[<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE article PUBLIC '-//OASIS//DTD DocBook XML V4.5//EN'
'http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd'>
<article lang="en">
<title>Sample article</title>
<para>This is a very short article.</para>
</article>]]></programlisting>
</example>
<para>In contrast, DocBook V5.0 does not depend on DTDs anymore. This
mean that there is no document type declaration and the version of DocBook
used is indicated with the <tag class="attribute">version</tag>
attribute instead.</para>
<example xml:id="ex.docbook5">
<title>DocBook V5.0 document</title>
<programlisting><![CDATA[<?xml version="1.0" encoding="utf-8"?>
<article xmlns="http://docbook.org/ns/docbook" version="5.0" xml:lang="en">
<title>Sample article</title>
<para>This is a very short article.</para>
</article>]]></programlisting>
</example>
<para>As you can see, DocBook V5.0 is built on top of existing XML
standards as much as possible, for example the <tag
class="attribute">lang</tag> attribute is superseded by the standard
<tag xl:href="http://www.w3.org/TR/REC-xml/#sec-lang-tag"
class="attribute">xml:lang</tag> attribute.</para>
<para>Another fundamental change is that there is no direct indication
of the schema used. Later in this document, you will learn how you can
specify a schema to be used for document validation.</para>
<note>
<para>Although we recommend the RELAX NG schema for DocBook
V5.0, there are also DTD and W3C XML Schema versions available (see <xref
linkend="schemas"/>) for tools that do not yet support RELAX NG.</para>
</note>
</section>
<section xml:id="introduction-why-to-switch">
<title>Why switch to DocBook V5.0?</title>
<para>The simple answer is <quote>because DocBook V5.0 is the
future</quote>. Apart from this marketing blurb, there are also more
technical reasons:</para>
<itemizedlist>
<listitem>
<para><emphasis>DocBook V4.x is feature frozen.</emphasis>DocBook V4.5
is the last version of DocBook in the V4.x series. Any new DocBook
development, like the addition of new elements, will be done in
DocBook V5.0. It is only matter of time before useful, new elements
will be added into DocBook V5.0, but they are not likely to be back
ported into DocBook V4.x. DocBook V4.x will be in maintenance mode and
errata will be published if necessary. </para>
</listitem>
<listitem>
<para><emphasis>DocBook V5.0 offers new functionality.</emphasis>
DocBook V5.0 provides significant improvements over DocBook V4.x. For
example there is general markup for annotations, a new and flexible
system for linking, and unified markup for information sections using
the <tag>info</tag> element.</para>
</listitem>
<listitem>
<para><emphasis>DocBook V5.0 is more extensible.</emphasis> Having
DocBook V5.0 in a separate namespace allows you to easily mix DocBook
markup with other XML-based languages like SVG, MathML, XHTML or even
FooBarML.</para>
</listitem>
<listitem>
<para><emphasis>DocBook V5.0 is easier to customize.</emphasis> RELAX
NG offers many powerful constructs that make customization much easier
than it would be using a DTD (see <xref linkend="customizations"/>).</para>
</listitem>
</itemizedlist>
</section>
<section xml:id="introduction-schemas">
<title>Schema jungle</title>
<para>Schemas for DocBook V5.0 are available in several formats at
<link xl:href="http://www.oasis-open.org/docbook/xml/&version;/"/> (or the
mirror at <link xl:href="http://docbook.org/xml/&version;/"/>).
Only the RELAX NG schema is normative
and it is preferred over the other schema languages. However, for your
convenience there are also DTD and W3C XML Schema versions provided for DocBook
V5.0. But please note that neither the DTD nor the W3C XML schema are able to
capture all the constraints of DocBook V5.0. This mean that a
document that validates against the DTD or XML schema is not necessarily
valid against the RELAX NG schema and thus may not be a valid
DocBook V5.0 document. See <xref linkend="t.schema-comparison"/> for
summary of constraints that are checked by different schemas.</para>
<para>DTD and W3C XML Schema versions of the DocBook V5.0 grammar are provided
as a convenience for users who want to use DocBook V5.0 with legacy tools
that don't support RELAX NG. Authors are encouraged to switch to RELAX
NG based tools as soon as possible, or at least to validate documents
against the RELAX NG schema before further processing.</para>
<para>Some document constraints can't be expressed in schema languages
like RELAX NG or W3C XML Schema. To check for these additional
constraints DocBook V5.0 uses Schematron. We recommend that you
validate your document against both the RELAX NG and
Schematron schemas.</para>
<table xml:id="t.schema-comparison">
<title>Schema Comparison</title>
<tgroup cols="6">
<colspec colwidth="4*"/>
<colspec colwidth="1*" align="center"/>
<colspec colwidth="1*" align="center"/>
<colspec colwidth="1*" align="center"/>
<colspec colwidth="1*" align="center"/>
<colspec colwidth="1*" align="center"/>
<thead>
<row>
<entry>Description</entry>
<entry>DTD</entry>
<entry>W3C XML Schema</entry>
<entry>W3C XML Schema + Schematron</entry>
<entry>RELAX NG</entry>
<entry>RELAX NG + Schematron/NVDL</entry>
</row>
</thead>
<tbody>
<row>
<entry>Basic document structure</entry>
<entry>&yes;</entry>
<entry>&yes;</entry>
<entry>&yes;</entry>
<entry>&yes;</entry>
<entry>&yes;</entry>
</row>
<row>
<entry>ID/IDREF datatypes</entry>
<entry>&yes;</entry>
<entry>&yes;</entry>
<entry>&yes;</entry>
<entry>&yes;</entry>
<entry>&yes;</entry>
</row>
<row>
<entry>Datatypes<footnote>
<para>In a very few places RELAX NG specifies datatype
like number (mainly for length specifications) or
enumeration between <literal>0</literal> and
<literal>1</literal>.</para>
<para>In general those datatypes can be also supported in
W3C XML Schema, but currently this schema is generated
from DTD which lacks datatype information.</para>
</footnote>
</entry>
<entry>&no;</entry>
<entry>&no;</entry>
<entry>&no;</entry>
<entry>&yes;</entry>
<entry>&yes;</entry>
</row>
<row>
<entry>Co-occurrences<footnote>
<para>RELAX NG grammar enforces exclusivity of several
elements. For example if you have <tag>title</tag> inside
<tag>info</tag> then it is not allowed to have another
<tag>title</tag> outside <tag>info</tag>. Similarly,
models of HTML and CALS tables are separated and validated
properly, where in DTD and WXS only union of both models is
available.</para>
<para>On other places co-occurrences enforces particular
content model based on presence of specific attribute or
attribute value.</para>
<para>Please also note that in theory co-occurences can be
validated using Schematron, but the current DocBook schema
uses RELAX NG for these definitions. Schematron can be used
only for validation, whereas grammar based schemas like
RELAX NG are useful also for other purposes like guided editing.</para>
</footnote></entry>
<entry>&no;</entry>
<entry>&no;</entry>
<entry>&no;</entry>
<entry>&yes;</entry>
<entry>&yes;</entry>
</row>
<row>
<entry>Hooks for MathML and SVG content</entry>
<entry>&no;</entry>
<entry>&no;</entry>
<entry>&no;</entry>
<entry>&yes;</entry>
<entry>&yes;</entry>
</row>
<row>
<entry>Link type integrity<footnote>
<para>Check whether ID/IDREF links are pointing to element
of corresponding type. For example that
<tag>footnoteref</tag> points to
<tag>footnote</tag>.</para></footnote></entry>
<entry>&no;</entry>
<entry>&no;</entry>
<entry>&yes;</entry>
<entry>&no;</entry>
<entry>&yes;</entry>
</row>
<row>
<entry>Presence of <tag class="attribute">version</tag>
attribute on the root element</entry>
<entry>&no;</entry>
<entry>&no;</entry>
<entry>&yes;</entry>
<entry>&no;</entry>
<entry>&yes;</entry>
</row>
<row>
<entry>Miscellaneous checks<footnote>
<para>For example consistency of segmented lists, only one
term inside term definition etc.</para></footnote></entry>
<entry>&no;</entry>
<entry>&no;</entry>
<entry>&yes;</entry>
<entry>&no;</entry>
<entry>&yes;</entry>
</row>
<row>
<entry>Element exclusions<footnote>
<para>Prevents improper nesting of elements, like admonition
inside admonition.</para></footnote></entry>
<entry>&no;</entry>
<entry>&no;</entry>
<entry>&yes;</entry>
<entry>&no;</entry>
<entry>&yes;</entry>
</row>
</tbody>
</tgroup>
</table>
<section xml:id="schemas">
<title>Where to get the schemas</title>
<para>The latest versions of schemas can be obtained from <link
xl:href="http://docbook.org/schemas/5x.html"/>. At the time this was
written the latest version was &version;. Individual schemas are
available at the following locations:</para>
<variablelist>
<varlistentry>
<term>RELAX NG schema</term>
<listitem><para><link xl:href="http://docbook.org/xml/&version;/rng/docbook.rng"/></para></listitem>
</varlistentry>
<varlistentry>
<term>RELAX NG schema in compact syntax</term>
<listitem><para><link xl:href="http://docbook.org/xml/&version;/rng/docbook.rnc"/></para></listitem>
</varlistentry>
<varlistentry>
<term>DTD</term>
<listitem><para><link xl:href="http://docbook.org/xml/&version;/dtd/docbook.dtd"/></para></listitem>
</varlistentry>
<varlistentry>
<term>W3C XML Schema</term>
<listitem><para><link xl:href="http://docbook.org/xml/&version;/xsd/docbook.xsd"/></para></listitem>
</varlistentry>
<varlistentry>
<term>Schematron schema with additional checks</term>
<listitem><para><link xl:href="http://docbook.org/xml/&version;/sch/docbook.sch"/></para></listitem>
</varlistentry>
</variablelist>
<para>These schemas are also available from the mirror at
<link xl:href="http://www.oasis-open.org/docbook/xml/&version;/"/>.</para>
</section>
<section xml:id="docs">
<title>DocBook documentation</title>
<para>Detailed documentation about each DocBook V5.0 element is
presented in <link
xl:href="http://docbook.org/tdg5/en/html/pt02.html">the reference part
of <citetitle>DocBook: The Definitive Guide</citetitle></link>.</para>
<note>
<para>Other parts of <citetitle>DocBook: The Definitive
Guide</citetitle> have not yet been updated to reflect the changes
made in DocBook V5.0. Please do not be confused by this.</para>
</note>
</section>
</section>
</section>
<section xml:id="tools">
<title>Tool chain</title>
<para>This section briefly describes tools and procedures to edit and
process content stored in DocBook V5.0.</para>
<section xml:id="editors">
<title>Editing DocBook V5.0</title>
<para>Because DocBook is an XML-based format and XML is a text-based
format, you can use any text editor to create and edit DocBook V5.0
documents. However, using <quote>dumb</quote> editors like Notepad is
not very productive. You will do better if you use an editor that
supports XML. Although there are DTD and W3C XML Schemas available for
DocBook V5.0, which means you can use any editor that works with DTDs
or W3C XML Schemas, we recommend that you use the RELAX NG grammar
with DocBook V5.0. The rest of this section contains an overview of
XML editors (listed in alphabetical order) that are known to work with
RELAX NG schemas and that offer guided editing based on the RELAX NG
schema.</para>
<section xml:id="editors-nxml">
<title>Emacs and nXML</title>
<para><link xl:href="http://www.thaiopensource.com/nxml-mode/">nXML
mode</link> is an add-on for the <application
xl:href="http://www.gnu.org/software/emacs/emacs.html">GNU
Emacs</application> text editor. By installing nXML you can turn Emacs
into a very powerful XML editor that offers guided editing and
validation of XML documents.</para>
<figure xml:id="f.emacs">
<title>Emacs with nXML mode provides guided editing and validation</title>
<mediaobject>
<imageobject role="html">
<imagedata fileref='images/emacs.png'/>
</imageobject>
<imageobject role="fo">
<imagedata fileref='images/emacs.png' width="100%"/>
</imageobject>
</mediaobject>
</figure>
<para>nXML uses a special configuration file named
<filename>schemas.xml</filename> to associate schemas with XML
documents. Often you will find this file in the directory
<filename>site-lisp/nxml/schema</filename> inside the Emacs installation
directory. Adding the following line into the configuration file,
will associate DocBook V5.0 elements with the appropriate
schema:</para>
<programlisting><namespace ns="http://docbook.org/ns/docbook" uri="<replaceable>/path/to/</replaceable>docbook.rnc"/></programlisting>
<note>
<para>Please note that nXML ships with a file named
<filename>docbook.rnc</filename>. This file contains the RELAX NG grammar
for DocBook V4.x. Be sure that you associate the DocBook V5.0 namespace
with the corresponding DocBook V5.0 grammar.</para>
</note>
<para>If you can't edit the global <filename>schemas.xml</filename> file,
you can create this file in the same directory as your document. nXML will
find associations placed there also. In this case you must create a
complete configuration file like:</para>
<programlisting><locatingRules xmlns="http://thaiopensource.com/ns/locating-rules/1.0">
<namespace ns="http://docbook.org/ns/docbook" uri="<replaceable>/path/to/</replaceable>docbook.rnc"/>
</locatingRules></programlisting>
</section>
<section xml:id="editors-oxygen">
<title>oXygen</title>
<para><application
xl:href="http://www.oxygenxml.com/">oXygen</application> is a feature
rich XML editor. It has built-in support for many schema languages
including RELAX NG and it is preconfigured with many document types
including DocBook. oXygen will assist you with writing DocBook V5.0
content, and you will be able to validate your documents against both
RELAX NG and Schematron schemas.</para>
<figure xml:id="f.oxygen.open5">
<title>DocBook V5.0 document opened in oXygen</title>
<mediaobject>
<imageobject>
<imagedata fileref='images/oxygen4.png' width="100%"/>
</imageobject>
</mediaobject>
</figure>
<figure xml:id="f.oxygen.author.mode">
<title>DocBook V5.0 document opened in oXygen in Author mode</title>
<mediaobject>
<imageobject>
<imagedata fileref='images/oxygen5.png' width="100%"/>
</imageobject>
</mediaobject>
</figure>
</section>
<section xml:id="editors-xxe">
<title>XML Mind XML editor</title>
<para><application xl:href="http://www.xmlmind.com/xmleditor/">XML
Mind XML editor</application> (XXE) is a visual validating XML editor that
provides a wordprocessor-like interface to users. It is available in
two versions, Standard and Professional. The Standard version is free and
provides everything you need to edit DocBook V5.0 documents.</para>
<figure xml:id="f.xmlmind">
<title>XML Mind XML Editor – feels almost like MS Word but real DocBook V5.0 markup is created</title>
<mediaobject>
<imageobject>
<imagedata fileref='images/xxe.png' width="100%"/>
</imageobject>
</mediaobject>
</figure>
<para>In order to use DocBook V5.0 in XXE you have to install
an add-on. Go to
<menuchoice><guimenu>Options</guimenu><guimenuitem>Install
Add-ons…</guimenuitem></menuchoice>. Then choose <guilabel>DocBook
5 configuration</guilabel> and press the <guibutton>OK</guibutton>
button. After restart, XXE is ready to work with DocBook V5.0
documents.</para>
</section>
</section>
<section xml:id="validators">
<title>Validating DocBook V5.0</title>
<para>If you are not using a RELAX NG-based validating editor when you
create documents, we strongly recommend that you validate your
documents against RELAX NG and Schematron schemas before processing
them. Only after successful validation can you be sure that your
document is really DocBook V5.0 and that processing tools will be able
to process it correctly.</para>
<para>For validation you can use tools that support simultaneous RELAX NG and
Schematron validation, or you can use NVDL to orchestrate validation using
the two schemas.</para>
<section xml:id="validators-rng-sch">
<title>Using RELAX NG and Schematron</title>
<para>You can find a list of RELAX NG validators at <link
xl:href="http://relaxng.org/#validators"/>. It is best to use
validators with support for embedded Schematron rules inside RELAX NG
schemas. Schematron is a rule-based validation language which is used
to impose additional constraints on DocBook documents. Schematron rules
assert conditions which are impossible or difficult to express
in a pure RELAX NG schema.</para>
<para><application xl:href="https://msv.dev.java.net/">Sun
Multi-Schema XML Validator (MSV)</application> is able to validate an XML
document against a RELAX NG schema and Schematron rules at the same time.
To install and use MSV follow these steps:</para>
<procedure>
<step>
<para>Download <filename>relames.zip</filename> from <link xl:href="https://msv.dev.java.net/servlets/ProjectDocumentList?folderID=101"/>.</para>
</step>
<step>
<para>Unpack the downloaded file into an arbitrary directory.</para>
</step>
<step>
<para>Validate your document using the following command:</para>
<screen><command>java</command> -Xss512K -jar <replaceable>/path/to/</replaceable>relames.jar <replaceable>/path/to/</replaceable>docbook.rng document.xml</screen>
<note>
<para>The switch <option>-Xss512K</option> increases the stack size
of the Java virtual machine. This is necessary because the DocBook schema is
quite large. If you get stack overflow errors from MSV, increase
this value. You may get spurious error messages if the value
is too small, so if you get a stack overflow error, ignore any other error
messages and try a larger value for the stack size.
If you are not using Sun's Java implementation, please consult the
documentation for your virtual machine to learn how to increase the stack
size.</para>
</note>
</step>
</procedure>
<para>There is also an <link
xl:href="http://relaxed.vse.cz/docbookvalidator/">on-line DocBook V5.0
validator</link> that validates DocBook V5.0 documents against the normative
RELAX NG schema with embedded Schematron rules.</para>
</section>
<section>
<title>Using NVDL</title>
<para>NVDL is a meta-schema language which can validate a document
against several schemas. DocBook V5.0 comes with a NVDL
schema which specifies that DocBook documents should be validated
against both RELAX NG and Schematron schemas.</para>
<para>You can find a list of NVDL validators at <link
xl:href="http://nvdl.org/"/>. The following procedures show how to
install and use the <application
xl:href="http://www.oxygenxml.com/onvdl.html">oNVDL</application> and
<application xl:href="http://jnvdl.sourceforge.net">JNVDL</application>
validators.</para>
<procedure>
<title>oNVDL installation and usage</title>
<step>
<para>Download <filename
xl:href="http://www.oxygenxml.com/InstData/onvdl/onvdl-20070517.zip">onvdl-20070517.zip</filename>.</para>
</step>
<step>
<para>Unpack the downloaded file into an arbitrary directory.</para>
</step>
<step>
<para>Validate your document using the following command:</para>
<screen><command>java</command> -jar <replaceable>/path/to/oNVDL/</replaceable>bin/onvdl.jar <replaceable>/path/to/</replaceable>docbook.nvdl document.xml</screen>
</step>
</procedure>
<procedure>
<title>JNVDL installation and usage</title>
<step>
<para>Download the latest release of JNVDL from <link
xl:href="http://sourceforge.net/project/showfiles.php?group_id=164464"/>.</para>
</step>
<step>
<para>Unpack the downloaded file into an arbitrary directory.</para>
</step>
<step>
<para>Modify file <filename>jnvdl.bat</filename> (or <filename>jnvdl.sh</filename> on Unix based systems) to include <option>-Xss512K</option> switch directly after <command>java</command> command.</para>
</step>
<step>
<para>On Windows systems, validate your document using the following command:</para>
<screen><replaceable>/path/to/jnvdl/</replaceable><command>jnvdl</command> -nt -s <replaceable>/path/to/</replaceable>docbook.nvdl document.xml</screen>
<para>On Unix systems, validate your document using the following command:</para>
<screen><replaceable>/path/to/jnvdl/</replaceable><command>jnvdl.sh</command> -nt -s <replaceable>/path/to/</replaceable>docbook.nvdl document.xml</screen>
</step>
</procedure>
</section>
</section>
<section xml:id="processing">
<title>Processing DocBook V5.0</title>
<para>Part of DocBook's great success can be attributed to the
availability of free
tools that can be used to transform DocBook content into various
target formats including HTML and PDF. The DocBook XSL Stylesheets are
very popular tools.</para>
<section xml:id="dbxsl">
<title>DocBook XSL Stylesheets</title>
<para>The DocBook stylesheets are designed to process content written in
different versions of DocBook (for example 3.1 and 4.2). Recent
versions of the stylesheets are also able to process DocBook V5.0
with some limitations.</para>
<para>You can process DocBook V5.0 documents with the DocBook XSL
stylesheets in exactly the same way you process DocBook V4.x documents.
You do not need special software; you can stick to your preferred
XSLT processor, be it Saxon, xsltproc, Xalan or whatever else (but see
the note about the lost base URI below).</para>
<para>During document processing, the stylesheets strip
namespaces from DocBook V5.0 to get a document which will be
very similar to DocBook V4.x. This is necessary because from the XSLT
point of view, elements from different namespaces are distinct and cannot
be easily processed by the same set of templates. This process is
completely transparent to the user. If you are processing DocBook V5.0
documents, the only difference is that you will see the following
additional message:</para>
<screen>Note: namesp. cut : stripped namespace before processing
Note: namesp. cut : processing stripped document</screen>
<para>Although you can successfully use the existing stylesheets to
process DocBook V5.0, there are some limitations and unsupported
features. The unsupported features include:</para>
<itemizedlist>
<listitem><para>general annotations;</para></listitem>
<listitem><para>general XLink links on all elements.</para></listitem>
</itemizedlist>
<note>
<para>During namespace stripping, the base URI of the document is
lost. This means that in rare situations, relatively referenced
resources like images or programlistings can be processed incorrectly.
The stylesheets attempt to compensate for this problem, but that is not always
possible. When an XSLT processor other than Saxon or Xalan is used, a warning
message is generated:
<screen>WARNING: cannot add @xml:base to node set root element. Relative paths may not work.</screen>
</para>
</note>
</section>
<section xml:id="dbxsl-ns">
<title>DocBook XSL-NS Stylesheets</title>
<para>As you can see from reading the previous section, namespace
stripping has limitations that will cause trouble in some
situations. To overcome those limitations, Bob Stayton created a
build system for taking the non-namespace-aware DocBook XSL
stylesheets and generating namespace-aware versions from them.
The DocBook <link
xl:href="http://docbook.sourceforge.net/release/xsl-ns/current/"
>XSL-NS stylesheets</link> are the result.</para>
<para>The DocBook XSL-NS stylesheets are released side-by-side
with the DocBook XSL stylesheets, as a separate <link
xl:href="https://sourceforge.net/project/showfiles.php?group_id=21935&package_id=219178"
><package>docbook-xsl-ns</package></link> package. They are the
recommended XSLT 1.0 stylesheets to use for transforming
namespaced (DocBook V5.0) documents.</para>
</section>
<section xml:id="dbxsl2">
<title>XSLT 2.0 based re-implementation</title>
<para>XSLT 1.0 is missing some important features. To work around
these missing features, the current DocBook XSL stylesheets use some
implementation-specific extensions.
XSLT 2.0 adds many new and previously missing features into the language.
A new set of DocBook stylesheets is being implemented based on XSLT 2.0
to take advantage of these features and to fully support DocBook V5.0.
</para>
<para>The XSLT 2.0 based stylesheets have many new features, including:</para>
<itemizedlist>
<listitem><para>seamless integration of profiling (conditional
documents) with external bibliographies and
glossaries;</para></listitem>
<listitem><para>no need for (most) external extensions;</para></listitem>
<listitem><para>internationalized indexes;</para></listitem>
<listitem><para>easy to customize titlepage templates.</para></listitem>
</itemizedlist>
<para>The XSLT 2.0 based stylesheets are still under development. At
this writing, they only support HTML and chunked HTML output. As time
permits, the stylesheet developers will be adding other formats. Since
the stylesheets are developed in the limited free time the developers
have, there's no specific schedule.</para>
<para>There are not very many XSLT 2.0 implementations available.
But, if you want to try the new stylesheets, grab a snapshot of
the development version from <link
xl:href="http://docbook.sourceforge.net/snapshots/docbook-xsl2-snapshot.zip"/>
and unpack it somewhere. Then download and install Saxon 9 from <link
xl:href="http://saxon.sf.net"/>.</para>
<para>To transform a DocBook V5.0 document to a single HTML page use the command:</para>
<screen><command>java</command> -jar <replaceable>/path/to/</replaceable>saxon9.jar -o output.html document.xml <replaceable>/path/to/</replaceable>docbook-xsl2-snapshot/html/docbook.xsl</screen>
<para>To transform a DocBook V5.0 document to a set of chunked HTML pages use the command:</para>
<screen><command>java</command> -jar <replaceable>/path/to/</replaceable>saxon9.jar document.xml <replaceable>/path/to/</replaceable>docbook-xsl2-snapshot/html/chunk.xsl</screen>
</section>
</section>
</section>
<section xml:id="changes">
<title>Markup changes</title>
<para>This section describes the most common markup changes
between DocBook V4.x and V5.0.
You can find a complete list of changes in
<citation>DB5SPEC</citation>.</para>
<section xml:id="changes-linking">
<title>Improved cross-referencing and linking</title>
<para>In DocBook V4.x the attribute <tag class="attribute">id</tag> is
used to assign a unique identifier to an element. In DocBook V5.0 this
attribute is renamed <tag class="attribute">xml:id</tag> in order
to comply with <citation>XMLID</citation>.</para>
<para>Now you can use almost any inline element as the source of a link,
not just <tag>xref</tag> or <tag>link</tag>. For example, the following
DocBook 4.x content:</para>
<programlisting><![CDATA[<section id="dir">
<title>DIR command</title>
<para>...</para>
</section>
<section id="ls">
<title>LS command</title>
<para>This command is a synonym for <link linkend="dir"><command>DIR</command></link> command.</para>
</section>]]></programlisting>
<para>is written in DocBook V5.0 as:</para>
<programlisting><![CDATA[<section xml:id="dir">
<title>DIR command</title>
<para>...</para>
</section>
<section xml:id="ls">
<title>LS command</title>
<para>This command is a synonym for <command linkend="dir">DIR</command> command.</para>
</section>]]></programlisting>
<para>The <tag class="attribute">linkend</tag> attribute was added to all
inline elements together with the <tag class="attribute">href</tag>
attribute from the XLink namespace. This means that you can use any inline
element as the source of a hypertext link. To use XLinks you have
to declare the XLink namespace (most often on the root element of your
document):</para>
<programlisting><![CDATA[<article xmlns="http://docbook.org/ns/docbook"
xmlns:xl="http://www.w3.org/1999/xlink" version="5.0">
<title>Test article</title>
<para><application xl:href="http://www.gnu.org/software/emacs/emacs.html">Emacs</application>
is my favourite text editor.</para>]]>
…</programlisting>
<para>The <tag condition="v4">ulink</tag> element was removed from DocBook V5.0
in favor of XLink linking. Instead of the DocBook V4.x <tag condition="v4">ulink</tag>
element:</para>
<programlisting><![CDATA[<ulink url="http://docbook.org">DocBook site</ulink>]]></programlisting>
<para>you can now use <tag>link</tag></para>
<programlisting><![CDATA[<link xl:href="http://docbook.org">DocBook site</link>]]></programlisting>
<para>XLink links may contain a fragment identifier, which you can
use instead of <tag class="attribute">linkend</tag> to form
cross-references inside a document; for example:</para>
<programlisting><![CDATA[<command xl:href="#dir">DIR</command>]]></programlisting>
<para>However XLink links are not checked during validation, while <tag
class="attribute">xml:id</tag>/<tag class="attribute">linkend</tag>
links are checked for ID/IDREF consistency.
One place where the XLink-based, fragment identifier scheme is
useful is when XInclude is being used, since XML ID/IDREF links
cannot span XInclude boundaries.
You can use whichever approach better suits your needs.</para>
</section>
<section xml:id="changes-renamed">
<title>Renamed elements</title>
<para>Some elements were renamed to better express their meaning or to
reduce the total number of elements available in DocBook.</para>
<table xml:id="t.renamed">
<title>Renamed elements</title>
<tgroup cols="2">
<thead>
<row>
<entry>Old name</entry>
<entry>New name</entry>
</row>
</thead>
<tbody>
<row>
<entry><tag condition="v4">sgmltag</tag></entry>
<entry><tag>tag</tag></entry>
</row>
<row>
<entry><tag condition="v4">bookinfo</tag>, <tag condition="v4">articleinfo</tag>,
<tag condition="v4">chapterinfo</tag>, <tag condition="nolink">*info</tag></entry>
<entry><tag>info</tag></entry>
</row>
<row>
<entry><tag condition="v4">authorblurb</tag></entry>
<entry><tag>personblurb</tag></entry>
</row>
<row>
<entry><tag condition="v4">collabname</tag>, <tag condition="v4">corpauthor</tag>,
<tag condition="v4">corpcredit</tag>, <tag condition="v4">corpname</tag></entry>
<entry><tag>orgname</tag></entry>
</row>
<row>
<entry><tag condition="v4">isbn</tag>, <tag condition="v4">issn</tag>,
<tag condition="v4">pubsnumber</tag></entry>
<entry><tag>biblioid</tag></entry>
</row>
<row>
<entry><tag condition="v4">lot</tag>, <tag condition="v4">lotentry</tag>, <tag condition="v4">tocback</tag>,
<tag condition="v4">tocchap</tag>, <tag condition="v4">tocfront</tag>, <tag condition="v4">toclevel1</tag>,
<tag condition="v4">toclevel2</tag>, <tag condition="v4">toclevel3</tag>, <tag condition="v4">toclevel4</tag>,
<tag condition="v4">toclevel5</tag>, <tag condition="v4">tocpart</tag></entry>
<entry><tag>tocdiv</tag></entry>
</row>
<row>
<entry><tag condition="v4">graphic</tag>, <tag condition="v4">graphicco</tag>,
<tag condition="v4">inlinegraphic</tag>, <tag condition="v4">mediaobjectco</tag></entry>
<entry><tag>mediaobject</tag> and <tag>inlinemediaobject</tag></entry>
</row>
<row>
<entry><tag condition="v4">ulink</tag></entry>
<entry><tag>link</tag></entry>
</row>
<row>
<entry><tag condition="v4">ackno</tag></entry>
<entry><tag>acknowledgements</tag></entry>
</row>
</tbody>
</tgroup>
</table>
</section>
<section xml:id="changes-removed">
<title>Removed elements</title>
<para>The following elements were removed from DocBook V5.0 without
direct replacements: <tag condition="v4">action</tag>, <tag
condition="v4">beginpage</tag>, <tag condition="v4">highlights</tag>,
<tag condition="v4">interface</tag>, <tag
condition="v4">invpartnumber</tag>, <tag
condition="v4">medialabel</tag>, <tag condition="v4">modespec</tag>,
<tag condition="v4">structfield</tag>, <tag
condition="v4">structname</tag>.
If you use one or more of these elements, here are some suggestions
as to how to re-code them in DocBook V5.0.
</para>
<table xml:id="t.removed">
<title>Recommended mapping for removed elements</title>
<tgroup cols="2">
<thead>
<row>
<entry>Old name</entry>
<entry>Recommended mapping</entry>
</row>
</thead>
<tbody>
<row>
<entry><tag condition="v4">action</tag></entry>
<entry>Use <computeroutput><<tag>phrase</tag> remap="action"></computeroutput>.</entry>
</row>
<row>
<entry><tag condition="v4">beginpage</tag></entry>
<entry>Remove: <tag condition="v4">beginpage</tag> is advisory only
and has tended to cause confusion. A processing instruction or
comment should be a workable replacement if one is needed.</entry>
</row>
<row>
<entry><tag condition="v4">highlights</tag></entry>
<entry>Use <tag>abstract</tag>. Note that because <tag
condition="v4">highlights</tag> has a broader content model, you may
need to wrap contents in a <tag>para</tag> inside
<tag>abstract</tag>.</entry>
</row>
<row>
<entry><tag condition="v4">interface</tag></entry>
<entry>Use one of the <quote>gui*</quote> elements
(<tag>guibutton</tag>, <tag>guiicon</tag>, <tag>guilabel</tag>,
<tag>guimenu</tag>, <tag>guimenuitem</tag>, or
<tag>guisubmenu</tag>).</entry>
</row>
<row>
<entry><tag condition="v4">invpartnumber</tag></entry>
<entry>Use <computeroutput><<tag>biblioid</tag> class="other"
otherclass="medialabel"></computeroutput>. The
<tag>productnumber</tag> element is another alternative.</entry>
</row>
<row>
<entry><tag condition="v4">medialabel</tag></entry>
<entry>Use <computeroutput><<tag>citetitle</tag>
pubwork="<replaceable>mediatype</replaceable>"></computeroutput>,
where <replaceable>mediatype</replaceable> is the type of media being