| Posted: 06 May 2005 20:03 | |
|
Registered User Currently Offline |
Posts: 12 Join Date: May 2005 |
|
Hi,
I use 'xinclude' to split my docbook document in smaller documents. I made the following changes into my docbook DTD to get it working: http://docs.linux.cz/programming/markup/www.s ... Currently I have to use first 'xmllint' to resolve the 'xinclude' references before to generate my output file with eDE. Is there a way to add support to 'xinclude' in eDE? Thanks for the answer Fabrice |
|
| Posted: 12 May 2005 20:15 | |
|
Registered User Currently Offline |
Posts: 32 Join Date: Feb 2005 |
|
We don't (currently) support XInclude out of the box. If you get it to work and tell us what you did, we'll happily include the changes into the main release.
The e-novative team |
|
| Posted: 17 May 2005 19:22 | |
|
Registered User Currently Offline |
Posts: 12 Join Date: May 2005 |
|
Ok I'll do some investigations and I'll keep you posted.
Indeed it would be really cool to add support for XInclude/olinks :-) Ciao Fabrice |
|
| Posted: 10 Jun 2005 17:19 | |
|
Registered User Currently Offline |
Posts: 12 Join Date: May 2005 |
|
Here is what I did to add support to XIncludes:
1. added support for xinclude in docbook DTD 2. split docbooks, created main docbook with includes 3. customized XSLT for images support 4. add a batch file for processing includes These 4 steps are described in more details here below. If you still have questions, don't hesitate to ask. Overall it works fine if your writer doesn't mind validating his links in 'ad-hoc' mode, i.e.: you first have to resolve the include and generate the complete docbook file to validate them (I use 'xref' and 'link' links, didn't get xpointer working yet). Ciao Fabrice 1. added support for xinclude in docbook DTD ------------------------------------------ all explained here: http://docs.linux.cz/programming/markup/www.s ... in my case I created c:\docbook\dtd\xinclude.mod 2. split docbooks, created main docbook with includes ----------------------------------------------------- split my docbook at 'chapter' level, for each of these docbooks I replaced the DTD root by 'chapter' and declared xinclude.mod: <!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN" "file:/c:/docbook/dtd/docbookx.dtd" [ <!ENTITY % xinclude SYSTEM "file:///c:/docbook/dtd/xinclude.mod"> %xinclude; in the main docbook, I also declared 'xinclude.mod' and included other docbooks as follow: ... <xi:include href="chapter1.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/> ... 3. customized XSLT for images support --------------------------------------- needed because after processing the includes, a 'xml:base' attribute is added (stores the include path for linking purposes). As a result, the xml:base attribute value is used as root path for images. Couldn't get rid of it, so I wrote a customization layer... If someone is interested, I can send the XSLT code by email 4. add a batch file for processing includes ---------------------------------------------- something like this: rem %1: docbook document input for transformation (contains the includes) rem %2: output type: 'html', 'htmlhelp' or 'pdf' (optional) rem %3: output directory (optional) call docbook_configuration.bat echo Resolving XIncludes for %1 docbook_document_repository%\%1\%1_inc.xml: xmllint.exe -xinclude %docbook_document_repository%\%1\%1_inc.xml > %docbook_document_repository%\%1\%1.xml rem set output directory if %2()==() ( echo validating %1 call docbook_validate %1 if not %errorlevel%==0 goto error ) else ( echo process docbook_%2 call docbook_%2_ %1 %3 ) :error exit /B -1 The following examples assume that: - the batch file is called 'docbook_includes.bat' - you created a repository called 'mydocbook' containing a file 'mydocbook_inc.xml' with the includes to resolve Example 1: "docbook_includes mydocbook" - resolves includes in mydocbook_inc.xml - copy resulting tree in mydocbook.xml and validate it Example 2: "docbook_includes mydocbook html" - resolves includes in mydocbook_inc.xml - copy resulting tree in mydocbook.xml and validate it - generate html output (ie: call batch file 'docbook_html mydocbook') Example 3: "docbook_includes mydocbook htmlhelp" - resolves includes in mydocbook_inc.xml - copy resulting tree in mydocbook.xml and validate it - generate htmlhelp output (ie: call batch file 'docbook_htmlhelp mydocbook') Example 4: "docbook_includes mydocbook pdf" - resolves includes in mydocbook_inc.xml - copy resulting tree in mydocbook.xml and validate it - generate pdf output (ie: call batch file 'docbook_pdf mydocbook') |
|
| Posted: 20 Jun 2005 10:50 | |
|
Administrator |
Posts: 125 Join Date: Feb 2005 |
|
Fabrice,
thank you so much for sharing the information. This is really nice. Should we integrate your solution into the main eDE distribution? |
|
| Posted: 22 Jun 2005 12:08 | |
|
Registered User Currently Offline |
Posts: 12 Join Date: May 2005 |
|
Of course, if you want to add it, go ahead (would be good to perform a sanity check to be sure I didn't forget anything).
I ran into another issue while using profiling: the 'docbook_includes' batch file does not resolve correctly tags with a condition attribute. Then the eDE validation breaks because of conditional links included in the final xml file while it shouldn't. My solution consists in using an extra transformation step to resolve the profiling conditions (ie: include only tags with 'condition' values matching the ones specified in the processing instruction). The drawback: I used 'xsltproc' to do it which required to add a 'C:\docbook\xsltproc' folder containing the xsltproc sources and to declare the 'C:\docbook\xsltproc' into the 'path' environment variable. I pasted the 'docbook_includes_profiles.bat' code at the end of the email. Feel free to include this solution in the next release of eDE and to modify it as you wish. Ciao Fabrice rem load configuration call docbook_configuration.bat echo Resolving XIncludes %docbook_document_repository%\%1\%1_%3_inc.xml: rem resolve XIncludes xmllint.exe -xinclude %docbook_document_repository%\%1\%1_%3_inc.xml > %docbook_document_repository%\%1\%1.temp.xml rem resolve profiling xsltproc --output %docbook_document_repository%\%1\%1.xml --stringparam profile.condition "%3;%2" %docbook_path%\xsl\profiling\profile.xsl %docbook_document_repository%\%1\%1.temp.xml rem delete temporary file del %docbook_document_repository%\%1\%1.temp.xml rem set output directory if %2()==() ( echo validating %1 call docbook_validate %1 if not %errorlevel%==0 goto error ) else ( echo process docbook_%2 call docbook_%2_profile %1 %3 %4 ) :error exit /B -1 |
|
| Posted: 22 Jun 2005 13:40 | |
|
Registered User Currently Offline |
Posts: 12 Join Date: May 2005 |
|
I forgot one thing in my last email.
The 'profile.xsl' stylesheet does not preserve the original DTD declaration. After running 'profile.xsl', your DTD declaration will look like this: <!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN" "file:/c:/docbook/dtd/docbookx.dtd"> This is a problem if you reference entity files like I do (or need to declare the xml:base attribute). To workaround this issue, you can use a CDATA tag for your entire DTD declarations. Then 'profile.xls' could look like this: <xsl:template match="/"> <xsl:text disable-output-escaping="yes"><![CDATA[ <!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN" "file:/c:/docbook/dtd/docbookx.dtd" [ <!ENTITY % local.common.attrib "xml:base CDATA #IMPLIED"> <!ENTITY % myEntity SYSTEM "myEntity.xml"> %myEntity; ]> ]]></xsl:text> <xsl:apply-templates select="." mode="profile"/> </xsl:template> Of course, you should adapt the CDATA content to yur needs. Hope this help. Fabrice |
|
| Posted: 06 Feb 2007 11:26 | |
|
Registered User Currently Offline |
Posts: 1 Join Date: Feb 2007 |
|
Thank you for this solution. I would really appreciate - and I am sure, others too - if e-novative included this into e-de. XIncludes is a very important feature in docbook-authoring. I found it a little bit amazing when I learned that this is not supported out of the box.
Thank you anyway for providing e-De. It's a great tool. Markus |
|
| Posted: 15 Feb 2007 18:10 | |
|
Registered User Currently Offline |
Posts: 28 Join Date: Apr 2005 |
| Are you really planning to make another eDE release? It's just that many of us have been waiting for years for the next release and, meanwhile, updated our own releases. If you could provide us with a release target date, we could send you wishes, tips etc. | |