| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195 | DocBook Assembly Stylesheets==============================bobs@sagehill.netThis directory provides XSL stylesheets for working withDocBook assemblies.  It is intended to enable working with<topic> and <assembly> elements, as defined in DocBook 5.1and later.This kit currently supports most features of an assembly.See the "Unsupported Features" section below for detailsof what is not currently supported.  These more advancedfeatures will be supported as it is further developed.Content of this directory:--------------------------topic-maker-chunk.xsl        - stylesheet to modularize an existing DB5 document.topic-maker.xsl              - imported by topic-maker-chunk.xsl.assemble.xsl                 - stylesheet to process an <assembly> into a document.The toolkit consists of an assemble.xsl XSL stylesheetto process a DocBook <assembly> element to convert itto an assembled DocBook 5 document ready to be formatted.This stylesheet will enable users to structure a book frommodular files.To make it easy to initially create a modular book, thiskit also includes a topic-maker-chunk.xsl XSL stylesheetto break apart an existing DocBook 5 book into modularfiles, and also create the associated <assembly> document.Then you can run the assemble.xsl stylesheet to put itback together as a single DocBook document.To create an assembly and topic files from a book or article document=======================================================================If you have an existing DocBook 5 book or article document,you can convert it to an assembly and a collection ofmodular topic files.  If you want to convert a DocBook 4document, you must first convert it to version 5.For example, to disassemble a DocBook 5 book document named book.xml:xsltproc --xinclude \         --stringparam assembly.filename myassembly.xml \         --stringparam base.dir topics/  \         topic-maker-chunk.xsl  \         mybook.xmlThis command will result in a master assembly file named'myassembly.xml' with a root element of <assembly>, containinga single <structure> element. It will also break up thecontent of the book into modular chunks that are outputto the 'topics/' subdirectory as specified in the 'base.dir'parameter.Options----------The name of the assembly file is set by the stylesheet paramnamed 'assembly.filename', which should include the filename suffix.Modular files are output to the directory location specifiedby the 'base.dir' parameter.  If you want them in the currentdirectory, then don't set that  param.By default the assembly element is output to the currentdirectory, *not* into base.dir with the modular files.The <resources> element in the assembly has its xml:baseattribute set to the value of 'base.dir', so that it isadded to the paths to the modular files when processed.If you set the stylesheet param 'manifest.in.base.dir'to 1, then the assembly file is created in the base.dirdirectory and the xml:base attribute is omitted (sincethey are together in the same directory).If you want the assembly file in 'base.dir' instead ofthe current directory, then set the stylesheet param'manifest.in.base.dir' to 1.The stylesheet chunks a document into modules at thesame boundaries as the chunking XHTML stylesheet, becauseit reuses many of the chunking stylesheet templates.You can alter the chunking behavior with the same optionsas for XHTML chunking.For example, the stylesheet will chunk sections into topicsdown to section level 3 by default.  To change that level,change the stylesheet param 'chunk.section.depth' toanother value.Finer control of chunking can be achieved by usingthe <?dbhtml stop-chunking?> processing instruction inthe source file.Many modular elements retain their original element name,such as glossary, bibliography, index, and such.  By default, thestylesheet converts chapter, article, preface and section elementsinto <topic> modules.  To change that list ofconverted element names, alter the stylesheet param named'topic.elements'.  If that param is empty, then no elementswill be converted to <topic>, so they will all retain theiroriginal element names.Modular filenames use the same naming scheme as the chunkingXHTML stylesheet, and supports the same file naming options such asthe param 'use.id.as.filename', which is set to 1 by default.Note that the stylesheet param 'html.ext' is set to '.xml'because it is producing modular XML files, not HTML files.Root element conversion------------------------By default, the root element of the original document is also converted to a module, and <structure> gets a resourcerefattribute to reference it.  If you set the stylesheetparam 'root.as.resourceref' to zero, then the root elementis handled differently, as described as follows.If the structure element does not have a resourcrefattribute, the root element is constructed ratherthan copied from a resource. The structure element musthave a renderas attribute (or its child output element musthave such) to select the output root element name.  Any content between the root element start tag and thefirst module is put into a resource with the originalroot element.  To pull this content in, the firstmodule in the structure points to this resource butuses a contentonly="yes" attribute. The effect ofthat attribute is to pull in all content *except*the root element of that resource.In general, if you have content that does not logicallyhave its own container element, you can put the contentinto a suitable container element and then deselect thecontainer element upon assembly with the contentonly="yes"attribute.  That attribute can also be used to avoidpulling in a resource's xml:id when you want to change it.To process an <assembly> into an assembled DocBook document==============================================================To convert an <assembly> and its associated modularfiles into a single DocBook document, processyour assembly document with the assemble.xsl stylesheet.You should then be able to process the resultingdocument with a DocBook XSL formatting stylesheet.Useful params in assemble.xsl-----------------------------The $root.default.renderas param sets the name of theroot element of the assembled document, if it is nototherwise specified with @renderas.  Its default valueis 'book'.The $topic.default.renderas param sets the name of theoutput element for any topic element included in theassembly, if it is not otherwise specified with@renderas.  It's default value is 'section'.The $structure.id param lets you specify at runtimethe id value of the structure you want to reassemble.This is only necessary if you have more than onestructure element in your assembly.The $output.type param also lets you specify at runtimewhich structure element to process.  In this case,the value should match on an @type attribute onthe structure element.The $output.format param lets you specify at runtimewhich of several possible output formats are being generated.The param value is compared to the @formatattribute on <output> elements to select specific propertiesfor a module.Unsupported Features-----------------------The transforms and transform elements are currently ignoredby the assembly stylesheet.The relationships and relationship elements are currentlyignored by the assembly stylesheet.The filterin and filterout elements are not currentlysupported.
 |