dbautosplit − automaticaly split DocBook document
dbautosplit [options] input_file [output_template]
dbautosplit −−help
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.
−−split= ELEMENTS
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".
−−split−add= ELEMENTS
Coma-separate list of XML elements which are addeded to previously specified tags list or to the default list. See −−split otpion.
−−split−del= ELEMENTS
Coma-separated list of XML elements which are removed from previously specified tags list or from the default list. See −−split option.
−l DEPTH , −−level= DEPTH
Specify recursion maximum depth level to DEPTH . The default maximum depth is 1.
−−lo−dirs= PATHS
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.
−−lo−dirs−add= PATHS
Coma-separeted list of paths which are addeded to preiously specified or the default local objects paths. See −−lo−dirs option.
−−lo−dir= DIRECTORY
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.
−−lo−move
Move local objects instead copy them. See LOCAL OBJECTS below.
−o= TEMPLATE , −−output−other= TEMPLATE
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.
−−xmlbase= URI
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.
−−xi−dtd[= FILE ]
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.
−−encoding= ENCODING
Enforce encoding for all output files.
−v, −−verbose
Increase verbosity level.
−q, −−quiet
Decrease verbosity level.
−V, −−version
Dump version information and exit.
−h, −?, −−help
Dump help screen and exit.
−−man
Show this manual page and exit.
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.
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 (
OPTIONS B) is one of (case
insensible):
Attribute( NAME ), Attr(
NAME )
Replace template by attribute value.
NodeName(), Name()
Replace template by name of node.
Depth()
Replace template by current depth.
Index()
Replace template by an unique increasing integer.
Text( STRING ), Txt( STRING )
Replace template by arbritrary string. All templates in STRING are expanded at first.
PerlEval( CODE ), Eval( CODE )
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.
dbautosplit −−level=0 −−om=new/mydoc.xml old/mydoc.xml
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.
dbautosplit −−om=new/mydoc.xml −−split−add="section" old/mydoc.xml
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.
dbautosplit
−−oo=’%eval(uc("%attr(id)?:%text(%name()−%index())/index.xml"))’
old/mydoc.xml
The output files names will have the same name as in default case but in uper case.
• |
How about cross-document ID/IDREF ? Help me. | ||
• |
Magnle entity referenced by entityref and targetdoent attributes. |
dbmerge(3), "DocBook: The Definitive Guide" <http://www.docbook.org/tdg/en/html/docbook.html>
Martin Lazar <mlazar@suse.cz>
Personal Opportunity - Free software gives you access to billions of dollars of software at no cost. Use this software for your business, personal use or to develop a profitable skill. Access to source code provides access to a level of capabilities/information that companies protect though copyrights. Open source is a core component of the Internet and it is available to you. Leverage the billions of dollars in resources and capabilities to build a career, establish a business or change the world. The potential is endless for those who understand the opportunity.
Business Opportunity - Goldman Sachs, IBM and countless large corporations are leveraging open source to reduce costs, develop products and increase their bottom lines. Learn what these companies know about open source and how open source can give you the advantage.
Free Software provides computer programs and capabilities at no cost but more importantly, it provides the freedom to run, edit, contribute to, and share the software. The importance of free software is a matter of access, not price. Software at no cost is a benefit but ownership rights to the software and source code is far more significant.
Free Office Software - The Libre Office suite provides top desktop productivity tools for free. This includes, a word processor, spreadsheet, presentation engine, drawing and flowcharting, database and math applications. Libre Office is available for Linux or Windows.
The Free Books Library is a collection of thousands of the most popular public domain books in an online readable format. The collection includes great classical literature and more recent works where the U.S. copyright has expired. These books are yours to read and use without restrictions.
Source Code - Want to change a program or know how it works? Open Source provides the source code for its programs so that anyone can use, modify or learn how to write those programs themselves. Visit the GNU source code repositories to download the source.
Study at Harvard, Stanford or MIT - Open edX provides free online courses from Harvard, MIT, Columbia, UC Berkeley and other top Universities. Hundreds of courses for almost all major subjects and course levels. Open edx also offers some paid courses and selected certifications.
Linux Manual Pages - A man or manual page is a form of software documentation found on Linux/Unix operating systems. Topics covered include computer programs (including library and system calls), formal standards and conventions, and even abstract concepts.