Question

I am new to docbook, but can not find a decent way to write some pieces of html code directly in the docbook xml structure. The best I could find was dbhtml-include, but it requires a separate html file to parse.

Is it possible to write a few html lines directly ?

What I am actually trying to do is to write math with mathjax inside docbook. There may be a smarter way to do this though.

Thanks for any help.

Was it helpful?

Solution

Is it possible to write a few html lines directly ?

It is always possible "to write directly" in XSLT and you can modify any XSLT stylesheet, including those of DocBook, to do so. A simple example below:

<xsl:stylesheet version="1.0"
 xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
 <xsl:output omit-xml-declaration="yes" indent="yes"/>

 <xsl:template match="/">
   <html>
     Hello, World!
   </html>
 </xsl:template>
</xsl:stylesheet>

However, intersparsing XSLT and html is an antipattern that leads od spaghetti-like code that is unreadable and difficult to maintain.

This explains the design decision of Norm Walsh for dbhtml-include.

A very powerful design pattern also is to have a form-like html that contains a few XML elements which after the transformation are substituted with specific content -- the fill-in-the-blanks pattern.

OTHER TIPS

FWIW, I usually just generate a barebones HTML page and then customize it with something like Sitemesh. Going from XML -> XSL -> Fully Customized HTML is generally a royal pain unless you are a master of figuring out some of the most complex XSLT stylesheets humanity has ever seen.

some advice; If you have a XML and XSL, you can easily generate HTML by XEP. I think it is too usefull. If have any questions, you can visit the forum of RenderX: http://cooltools.renderx.com Also you can try a trial version of XEP from (http://www.renderx.com/tools/index.html)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top