Scroll to navigation

DBAUTOSPLIT(1) DocBook Splitting tools DBAUTOSPLIT(1)

NAME

dbautosplit - automaticaly split DocBook document

SYNOPSIS

dbautosplit [options] input_file [output_template]

dbautosplit --help

DESCRIPTION

dbautosplit is tool for automaticaly splitting DocBook documents. It use XInclude (see <http://www.w3.org/TR/xinclude/>) for include document fragments. This allow split large XML file to smaler files withal preserve validation.

Splitting is possible in any element. Default is "book", "part", "chapter", "article", "preface", "reference" and "refentry". Morewer you may specify maximum depth level. Output file names are full customizable. It is possible to get tree structure corespond to hiearchy of sections in DocBook document.

All "xml:base" attributes (see <http://www.w3.org/TR/xmlbase/>) are processed and them removed. Relative references in "fileref" and "url" attributes are properly rewrited. So it is posible to use dbautosplit (with maximum level depth set to zero) as inteligent "xml:base" attribute remover and so as intelignet DocBook copyier.

If no output teplate is specified, default out/index.xml is used. See TEMPALTE EXPANSION below.

OPTIONS

Coma-separated list of XML elements in which is required spliting. Asterisk ('*') means any tag. The default is "book", "part", "chapter", "article", "preface" "reference" and "refentry".
Coma-separate list of XML elements which are addeded to previously specified tags list or to the default list. See --split otpion.
Coma-separated list of XML elements which are removed from previously specified tags list or from the default list. See --split option.
Specify recursion maximum depth level to DEPTH. The default maximum depth is 1.
Coma-separated list of paths in which are located local objects (see LOCAL OBJECTS below). All paths are expanded as the standart Unix shell would do, see File::Glob(3perl) for details. Relative paths is related to curent working directory. If path contains $XML_BASE at the begining it is replaced by real base of input document, see option --xmlbase below. Default paths are LocalObjects, MediaObjects, ImageObjects and #Pictures in base directory of input document.
Coma-separeted list of paths which are addeded to preiously specified or the default local objects paths. See --lo-dirs option.
Name of local objects directory for newly created documents (see LOCAL OBJECTS below). Relative path is related to newly created documents. Default directory is LocalObjects.
Move local objects instead copy them. See LOCAL OBJECTS below.
TEMPLATE for other (included) output files (see TEMPALTE EXPANSIONS below). Relative path is related to parent. The default is %attr(id)?:%text(%name()-%02index())/index.xml.
XML base URI (Uniform Resource Identifier) for input document. See <http://www.w3.org/TR/xmlbase/> for details. You may need change default if you simple copy an DocBook document without copying referenced files nor changing "fileref" attributes. On this case set XML base to orginal location. Note, URI is required not (unix) file name.
Append minimal internal subset for support "xi:include" element. If FILE is specified then entiry reference to this external subset is inserted instead. Relative path is related to curent work directory.
Enforce encoding for all output files.
Increase verbosity level.
Decrease verbosity level.
Dump version information and exit.
Dump help screen and exit.
Show this manual page and exit.

LOCAL OBJECTS

Local objects are special files (pictures, audio files, ...) in directories specified by --lo-dirs option. If DocBook document refer (via "fileref" attribute) to this directory, the files are copied (or moved) to local "Local Objects Directory" specified by --lo-dir option. Moreower all files with same name and differ suffix (after last dot) are copied (or moved) too.

TEMPLATE EXPANSIONS

In output file names are recognized special templates with following syntax:

TEMPLATE := %[FORMAT]COMMAND(OPTIONS)[?TEMPLATE[:TEMPLATE]]

where FORMAT is format modifier as for "%s" format in "printf" command, and COMMAND(OPTIONSB) is one of (case insensible):

Replace template by attribute value.
Replace template by name of node.
Replace template by current depth.
Replace template by an unique increasing integer.
Replace template by arbritrary string. All templates in STRING are expanded at first.
Replace template by result of evalution arbritraty perl code. All templates in CODE are expanded at first.

Optionaly the first template can by folloved question mark, second temlate, colon mark and third temlpate. On this case if expansion of the first template is emty the second template is expanded otherwise third template is expanded.

EXAMPLES

Copy file mydoc.xml from old/ to new/ directory, remove all xml:base attributes and properly rewrite all relative fileref references so they refer to same files. If they are reference to files in local objects directoryes, they will be copyed.
Same as above, but new/mydox.xml is now splited in defaults elements plus in element "section". Name of output files according to default output template (except main output file which is specified) which is %attr(id)?:%text(%name()-%02index())/index.xml. That mean every splited part create own directory in new directory and file index.xml in this directory. Name of this directory will be the value of "id" attribute or name of splited element followed by dash and an integer if there is no "id" attribute specified.
The output files names will have the same name as in default case but in uper case.

BUGS AND TODO

  • How about cross-document ID/IDREF? Help me.
  • Magnle entity referenced by entityref and targetdoent attributes.

SEE ALSO

dbmerge(3), "DocBook: The Definitive Guide" <http://www.docbook.org/tdg/en/html/docbook.html>

AUTHOR

Martin Lazar <mlazar@suse.cz>

2004-01-27 0.6