Re: DocBook XSL stylesheet customization

Hussein Shafie <[email protected]> Tue, 22 Nov 2022 10:03:40 +0100
Newsgroups gmane.editors.xxe.general
Message-ID <[email protected]>
Hugo F. wrote:
> 
> We are having some trouble with a customization in DocBook and we would 
> like to check the XSL-FO file before it is processed by XFC.

The simplest and safest way to customize the conversion of DocBook 
documents to other format is to use Options|"Customize 
Configuration"|"Customize Document Conversion Stylesheets".

See 
http://www.xmlmind.com/xmleditor/_distrib/doc/help/customizeConfigurationMenu.html

This displays the "Customize Document Conversion Stylesheets" dialog box 
and lets you use its "XMLmind XSL Customizer" helper application.

See 
http://www.xmlmind.com/xmleditor/_distrib/doc/help/conversion_stylesheets_editor.html

See 
http://www.xmlmind.com/xmleditor/_distrib/doc/help/com.xmlmind.xslcustom.Customizer.html

We cannot help you if you do it any other way than using the above 
tools. Sorry.



> 
> Could you please confirm if (and also how, if possible) we could call 
> saxon from the command line to have access to the intermediate file?

1) Convert your DocBook document to the XSL-FO based format and then 
click the "Show Message Log" icon found in the status bar then select 
log category "Command Execution".

See http://www.xmlmind.com/xmleditor/_distrib/doc/help/statusTool.html
---
These messages are sorted by category. One of the most useful category 
is "Command Execution" which contains the messages reported during the 
execution of the last command. Commands such as DocBook → Convert 
Document → Convert to PDF are really verbose, that's why this category 
is so useful.
---

Examining the contents of the log shows you what exactly does XMLmind 
XML Editor when converting your document.

Based on this you may try to invoke Saxon (version 6.5, not version 10) 
yourself. But, see below.




2) Invoking Saxon yourself is definitely NOT recommended as a way to 
access the intermediate XSL-FO file. Inconvenient, messy and error prone.

The recommended way to do this is to add attribute debug="true" to the 
process command used to convert your DocBook document. Example:
---
   <command name="db51.toRTF">
     <process debug="true">
       <info>
       ...
       <processFO processor="XFC" file="__doc.fo" to="__doc.%0">
       ...
       <upload base="%2">
        <copyFile file="__doc.%0" to="%2" />
       </upload>
     </process>
   </command>
---

See 
http://www.xmlmind.com/xmleditor/_distrib/doc/commands/process_attributes.html
---
If specified as true, this attribute prevents the command from deleting 
its work directory (/tmp/xxeNNNN/) at the end of the processing. This is 
useful if, for example, you need to look at the XSL-FO file generated by 
the transform element of the process command.
---

The file of interest is called "__doc.fo" and is found in the "xxeNNNN" 
temporary directory created each time you invoke "Convert Document".

Now, where is the parent of this temporary directory? Is it just 
"/tmp/"? No, this depends on your operating system.

And also which process command and where it is found? This depends on 
the version of DocBook you use and on the output format.

Using "Show Message Log"|"Command Execution" as explained in (1) answers 
all these questions.



Let's assume your are generating XSL-FO to process it using XFC.

DocBook 4: <command name="docb.toRTF">
found in XXE_install_dir/addon/config/docbook/xslMenu.incl

DocBook 5: <command name="db5.toRTF">
found in XXE_install_dir/addon/config/docbook5/docbook5_convert_menu.incl

DocBook 5.1 book or article: <command name="db51.toRTF">
found in XXE_install_dir/addon/config/docbook51/docbook51_convert_menu.incl

DocBook 5.1 assembly: <command name="asm.toRTF">
found in XXE_install_dir/addon/config/docbook51/assembly_convert_menu.incl

--
XMLmind XML Editor Support List
[email protected]
http://www.xmlmind.com/mailman/listinfo/xmleditor-support