Showing posts with label docbook. Show all posts
Showing posts with label docbook. Show all posts

Thursday, September 11, 2014

Having fun with docbook

For some reason you need to apply the dbfo at different level to apply properties to an element:
<example>
<?dbfo pgwide="1"?> <!-- example level -->
<title>
Full example
</title>
<programlisting language="csharp">
<?dbfo keep-together="auto" ?> <!-- at programlisting level -->
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="MyCode.cs" parse="text"/></programlisting>
</example>
Reference: http://www.sagehill.net/docbookxsl/PageBreaking.html

Don't ask...

Saturday, April 10, 2010

Exporting the DICOM Standard to docbook

I have finally found sometime to update PS 3.3 XML in GDCM using the newest standard: PS 3.3 - 2009.

It seems however that there has been some internal changes in OpenOffice.org and the docbook export function does not work as well as it used to be.

For instance see this bug report:

http://www.openoffice.org/issues/show_bug.cgi?id=110762

Wednesday, March 17, 2010

Failure reading file:///bla.xml: docbookV4.5/docbookx.dtd (No such file or directory)

I was trying to generate PDF from my input docbook file trying to use Saxon. I had used xsltproc without any issue so far until today.

Here is the issue, by default serna generate the following header:

<?xml version='1.0' encoding='UTF-8'?>
<!-- This document was created with Syntext Serna Free. -->
<!DOCTYPE article PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "docbookV4.5/docbookx.dtd" []>

So in order to find this docbookx.dtd file, you have two options either use the system identifier or the public identifier. Apparently on debian xsltproc is properly setup so as to take the public identifier, while saxon + resolver is setup to use the system one.

Ref:
http://patch-tracker.debian.org/patch/debianonly/view/libxml-commons-resolver1.1-java/1.2-5

--- libxml-commons-resolver1.1-java-1.2.orig/debian/CatalogManager.properties
+++ libxml-commons-resolver1.1-java-1.2/debian/CatalogManager.properties
@@ -0,0 +1,61 @@
+########################################################################
+# CatalogManager provides an interface to the catalog properties.
+# Properties can come from two places: from system properties or
+# from a CatalogManager.properties file. This class provides a
+# transparent interface to both, with system properties preferred
+# over property file values.
+
+#######################################################################
+# Catalog Files:
+# The semicolon-delimited list of catalog files.
+# Example: catalogs=./xcatalog;/share/doctypes/catalog
+
+catalogs=/etc/xml/catalog
+
+#######################################################################
+# Relative Catalogs:
+# If false, relative catalog URIs are made absolute with respect to the
+# base URI of the CatalogManager.properties file. This setting only
+# applies to catalog URIs obtained from the catalogs property in the
+# CatalogManager.properties file
+# Example: relative-catalogs = [yes|no]
+
+relative-catalogs=yes
+
+#######################################################################
+# Verbosity:
+# If non-zero, the Catalog classes will print informative and debugging
+# messages. The higher the number, the more messages.
+# Example: verbosity = [0..99]
+
+verbosity=0
+
+#######################################################################
+# Prefer:
+# Which identifier is preferred, "public" or "system"?
+# Example: xml.catalog.prefer = [public|system]
+
+prefer=system
+


I think this is a better solution to use public identifier so I change my settings. But technically an easier solution is simply to use proper public AND system identifier:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE article PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd">

Tuesday, February 23, 2010

Syntax Highlighting in DocBook

I am continuing to use DocBook, and I discovered that you can have syntax highlighting within your element.

* http://www.sagehill.net/docbookxsl/SyntaxHighlighting.html

Well technically you can only do that using a customization layer:

* http://www.sagehill.net/docbookxsl/CustomMethods.html

Then set the appropriate params:

* http://docbook.sourceforge.net/release/xsl/current/doc/fo/highlight.source.html

You also need to set this one:

* http://docbook.sourceforge.net/release/xsl/current/doc/html/highlight.xslthl.config.html

I had to use the following syntax on my linux box:


$ java -classpath /usr/share/java/saxon.jar:/home/mathieu/Software/xslthl/xslthl-2.0.1.jar -Dxslthl.config="file:////home/mathieu/Software/xslthl/highlighters/xslthl-config.xml" com.icl.saxon.StyleSheet -o myfile.html input.xml myhtml.xsl
Because I could not figure out how to use highlight.xslthl.config. After struggling for a bit:

* http://www.mail-archive.com/[email protected]/msg13791.html

One simply needs to use the URL notation for file address, in this case:


<xsl:param name="highlight.xslthl.config">file:////home/mathieu/Software/xslthl/highlighters/xslthl-config.xml</xsl:param>

I then started to play with xslthl, and make a cmake DocBook syntax highlighting file:

* http://gdcm.svn.sf.net/viewvc/gdcm/Sandbox/debian-med/xslthl/cmake-hl.xml?view=markup

Reference:
* http://sourceforge.net/apps/mediawiki/xslthl/index.php?title=Syntax_Highlighters

Wednesday, January 27, 2010

How about dblatex ?

After much struggle with fop, I gave dblatex another try. I quickly discover the secret options I was loooking for:

$ dblatex -P doc.collab.show=0 -P latex.output.revhistory=0 -P doc.toc.show=0 input.xml

Indeed I could remove the revision history and the collaborators section which looked suprising the first time I used dblatex.

I found out this trick here:

* http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=492366#14

The documentation

* http://dblatex.sourceforge.net/doc/sec-custom.html