docbook-apps

  • 1.  Xsltproc with XInclude (Docbook 5)

    Posted 05-02-2016 00:44
    Hi,

    I am trying to find a suitable combination of tools under Linux (currently Fedora 23) for validating and publishing from Docbook 5 to PDF, PostScript, RTF, and some variant of HTML (preferably xhtml strict, but most any variant will work). Some of my testing "almost" works via xsltproc using the sourceforge download for docbook.xsl, but apparently what I need is the "xi" version, docbookxi.xsl, which I have not been able to find. If I give up dividing into multiple files vi XInclude, and instead use a DTD and entities, or else create one large monolithic file, things work...however, this is very difficult to work with...I'd end up going back to less desirable less flexible tools.

    For use of Docbook 5 under Linux and xsltproc, where would I find a suitable XInclude stylesheet (docbook.xsl)? Or is there some other recommended route for processing Docbook 5 books while splitting into separate files for each chapter?

    Thanks!


  • 2.  Re: [docbook-apps] Xsltproc with XInclude (Docbook 5)

    Posted 05-02-2016 01:09

    Hello palindromic stimits,

    >I am trying to find a suitable combination of tools under Linux
    >(currently Fedora 23) for validating and publishing from Docbook 5
    >to PDF, PostScript, RTF, and some variant of HTML (preferably xhtml
    >strict, but most any variant will work). Some of my testing
    >"almost" works via xsltproc using the sourceforge download for
    >docbook.xsl, but apparently what I need is the "xi" version,
    >docbookxi.xsl, which I have not been able to find.

    I do not know of any such thing. It may exist, but I have never
    heard of it.

    Separate the two problems.

    You want to 1) use xinclude and 2) transform your Docbook.

    >If I give up dividing into multiple files vi XInclude, and instead
    >use a DTD and entities, or else create one large monolithic file,
    >things work...however, this is very difficult to work with...I'd
    >end up going back to less desirable less flexible tools.
    >
    >For use of Docbook 5 under Linux and xsltproc, where would I find a
    >suitable XInclude stylesheet (docbook.xsl)? Or is there some other
    >recommended route for processing Docbook 5 books while splitting
    >into separate files for each chapter?

    I have little experience with Docbook 5.x (mostly Docbook 4.x), but
    I have dabbled with it and here's what I do. This works famously
    for Docbook 4.x and seems to work just fine for me for Docbook 5.x.
    Sure, I have to process the entire document every time, but that's
    just fine, as far as I'm concerned. At least, I can still organize
    the document as I would like.

    Note: I'll show my validation steps for Docbook 5.x, as well.

    xmllint --nonet --noent --xinclude book.xml > monolithic.xml
    jing /path/to/5.x/docbook.rng monolithic.xml

    If jing doesn't complain, you should be able then to move along to
    processing with the docbook5-xsl-stylesheets. I show the path on my
    system, yours will probably differ slightly. (No laboratory
    command-lines were tested in the production of this email.)

    xsltproc > monolithic-one-page.html \
    --nonet \
    /usr/share/xml/docbook/stylesheet/nwalsh5/1.78.1/html/docbook.xsl \
    monolithic.xml

    xsltproc > monolithic.fo \
    --nonet \
    /usr/share/xml/docbook/stylesheet/nwalsh5/1.78.1/fo/docbook.xsl \
    monolithic.xml

    fop -fo monolithic.fo -pdf monolithic.pdf

    # some people prefer PDF from dblatex:
    # dblatex -F xml -t pdf -o monolithic.pdf monolithic.xml

    You can probably figure out how to get from PDF to Postscript.

    As for RTF, I've no idea, but maybe 'pandoc' is your friend here.

    In the stylesheets directory, you should be able to find the
    stylesheets for html, xhtml and xhtml5. If you need to know the
    distinction between these, perhaps somebody else can address that.

    The answer may be in the book on the Docbook Stylesheets:

    http://www.sagehill.net/docbookxsl/

    Best of luck and may the best namespace be unadorned,

    -Martin

    P.S. I think the docbook stylesheets are great. And both the
    printed book and the online documentation are fantastic. Yes,
    Bob Stayton--I know you are usually reading here, so thank you...

    --
    Martin A. Brown
    http://linux-ip.net/



  • 3.  Re: [docbook-apps] Xsltproc with XInclude (Docbook 5)

    Posted 05-02-2016 06:36
    Also on Fedora 23, 64bit

    On 2 May 2016 at 01:43, <stimits@comcast.net> wrote:
    > Hi,
    >
    > I am trying to find a suitable combination of tools under Linux (currently
    > Fedora 23) for validating and publishing from Docbook 5 to PDF, PostScript,
    > RTF, and some variant of HTML (preferably xhtml strict, but most any variant
    > will work).

    Edit: Emacs.
    Validate: Jing
    to PDF: One of the two commercial XSL-FO tools, Antenna House or XEP
    RTF: Steve? I can't find it (GIYF)
    PS: Don't know.
    HTML: Standard Docbook transforms.


    Some of my testing "almost" works via xsltproc using the
    > sourceforge download for docbook.xsl, but apparently what I need is the "xi"
    > version, docbookxi.xsl, which I have not been able to find. If I give up
    > dividing into multiple files vi XInclude, and instead use a DTD and
    > entities, or else create one large monolithic file, things work...however,
    > this is very difficult to work with...I'd end up going back to less
    > desirable less flexible tools.

    You might want to shift from the DTD's to relax ng, then use the namespaced
    version.

    xsltproc might work, but I have bash shell scripts for all my conversions.


    >
    > For use of Docbook 5 under Linux and xsltproc, where would I find a suitable
    > XInclude stylesheet (docbook.xsl)? Or is there some other recommended route
    > for processing Docbook 5 books while splitting into separate files for each
    > chapter?

    I expand my includes using the resolver.jar file?

    ava -cp /sgml:/myjava/saxon655.jar:/myjava/xercesImpl.jar:/myjava/resolver.jar
    -Djavax.xml.parsers.DocumentBuilderFactory=org.apache.xerces.jaxp.DocumentBuilderFactoryImpl
    -Djavax.xml.parsers.SAXParserFactory=org.apache.xerces.jaxp.SAXParserFactoryImpl
    -Dorg.apache.xerces.xni.parser.XMLParserConfiguration=org.apache.xerces.parsers.XIncludeParserConfiguration
    com.icl.saxon.StyleSheet -o op.html -w1 .xml
    docbook.html.xsl "saxon.extensions=1" $4 $5 $6

    HTH



    --
    Dave Pawson
    XSLT XSL-FO FAQ.
    Docbook FAQ.
    http://www.dpawson.co.uk



  • 4.  Re: [docbook-apps] Xsltproc with XInclude (Docbook 5)

    Posted 05-02-2016 08:21
    Dne 2.5.2016 v 08:36 Dave Pawson napsal(a):
    > Edit: Emacs.
    > Validate: Jing
    > to PDF: One of the two commercial XSL-FO tools, Antenna House or
    > XEP
    > RTF: Steve? I can't find it (GIYF)
    > PS: Don't know.
    > HTML: Standard Docbook transforms.

    Apache FOP supports conversion from XSL-FO to PDF, PS, RTF and several
    other formats as well. But some XSL-FO features are not implemented in
    it yet.

    http://xmlgraphics.apache.org/fop/

    Regards,
    Martin Doucha




  • 5.  Re: [docbook-apps] Xsltproc with XInclude (Docbook 5)

    Posted 05-02-2016 09:58
    Let me share my Makefile with you

    1 html:
    2 rm -rf site
    3 mkdir site
    4 cp css/* site
    5 xmllint --noent --xinclude \
    6 module.xml >
    /tmp/docbresolved.xml \
    7 2>./errloglint
    8 xsltproc \
    9 --output site/ \
    10 docbook.xsl \
    11 /tmp/docbresolved.xml \
    12 2>./errlogxslt && \
    13 tar czf site.tgz site/*
    14 echo "site.tgz ready for deployment"
    15
    16 pdf:
    17 xmllint --noent --xinclude \
    18 module.xml >
    /tmp/docbresolved.xml \
    19 2>./errloglint
    20 xsltproc \
    21 --xinclude \
    22 --output /tmp/docbfo.fo \
    23 docbook.fo.xsl \
    24 /tmp/docbresolved.xml \
    25 2>./errlogxslt && \
    26 fop -fo /tmp/docbfo.fo \
    27 module.pdf \
    28 2>./errlogfop
    29 rm /tmp/docbfo.fo
    30 echo "module.pdf ready for deployment"

    I only create html or pdf, not the other output formats.
    I use xmllint to process the includes. I use includes extensively

    An example of the top level document



    %uvmatent;
    ]>
    <book version="5.0" xmlns="http://docbook.org/ns/docbook"
    xmlns:xi="http://www.w3.org/2001/XInclude"
    xml:lang="da">


    <xi:include href="prepost/bookinfo.docbook.xml" />
    <xi:include href="prepost/forord.docbook.xml" />

    <part>

    <xi:include href="chapters/javaLekt1.docbook.xml" />
    <xi:include href="chapters/javaLekt2.docbook.xml" />
    <xi:include href="chapters/javaLekt3.docbook.xml" />
    <xi:include href="chapters/javaLekt4.docbook.xml" />
    <xi:include href="chapters/javaLekt5.docbook.xml" />
    <xi:include href="chapters/javaLekt6.docbook.xml" />
    <xi:include href="chapters/javaLekt7.docbook.xml" />
    <xi:include href="chapters/javaLekt8.docbook.xml" />
    <xi:include href="chapters/javaLekt9.docbook.xml" />
    <xi:include href="chapters/javaLekt10.docbook.xml" />
    </part>


    The chapters are built from sections, also includes.
    Coding examples (these are programming lessons) are also
    includes with live code:

    <programlisting language="java"><xi:include
    href="../codej/lesson4/src/CprTestObject.java"
    parse="text"/></programlisting>

    The includes provide maximum flexibility. Couldn't do it without them.

    Hope you find this useful.

    Niels Muller Larsen, MSc
    Programmer, Assoc Professor

    Ring around the collar.

    On 05/02/16 08:36, Dave Pawson wrote:
    > Also on Fedora 23, 64bit
    >
    > On 2 May 2016 at 01:43, <stimits@comcast.net> wrote:
    >> Hi,
    >>
    >> I am trying to find a suitable combination of tools under Linux (currently
    >> Fedora 23) for validating and publishing from Docbook 5 to PDF, PostScript,
    >> RTF, and some variant of HTML (preferably xhtml strict, but most any variant
    >> will work).
    >
    > Edit: Emacs.
    > Validate: Jing
    > to PDF: One of the two commercial XSL-FO tools, Antenna House or XEP
    > RTF: Steve? I can't find it (GIYF)
    > PS: Don't know.
    > HTML: Standard Docbook transforms.
    >
    >
    > Some of my testing "almost" works via xsltproc using the
    >> sourceforge download for docbook.xsl, but apparently what I need is the "xi"
    >> version, docbookxi.xsl, which I have not been able to find. If I give up
    >> dividing into multiple files vi XInclude, and instead use a DTD and
    >> entities, or else create one large monolithic file, things work...however,
    >> this is very difficult to work with...I'd end up going back to less
    >> desirable less flexible tools.
    >
    > You might want to shift from the DTD's to relax ng, then use the namespaced
    > version.
    >
    > xsltproc might work, but I have bash shell scripts for all my conversions.
    >
    >
    >>
    >> For use of Docbook 5 under Linux and xsltproc, where would I find a suitable
    >> XInclude stylesheet (docbook.xsl)? Or is there some other recommended route
    >> for processing Docbook 5 books while splitting into separate files for each
    >> chapter?
    >
    > I expand my includes using the resolver.jar file?
    >
    > ava -cp /sgml:/myjava/saxon655.jar:/myjava/xercesImpl.jar:/myjava/resolver.jar
    > -Djavax.xml.parsers.DocumentBuilderFactory=org.apache.xerces.jaxp.DocumentBuilderFactoryImpl
    > -Djavax.xml.parsers.SAXParserFactory=org.apache.xerces.jaxp.SAXParserFactoryImpl
    > -Dorg.apache.xerces.xni.parser.XMLParserConfiguration=org.apache.xerces.parsers.XIncludeParserConfiguration
    > com.icl.saxon.StyleSheet -o op.html -w1 .xml
    > docbook.html.xsl "saxon.extensions=1" $4 $5 $6
    >
    > HTH
    >
    >
    >



  • 6.  Re: [docbook-apps] Xsltproc with XInclude (Docbook 5)

    Posted 05-02-2016 14:09
    On Mon, 2016-05-02 at 00:43 +0000, stimits@comcast.net wrote:
    > Hi,
    >
    > I am trying to find a suitable combination of tools under Linux
    > (currently Fedora 23) for validating and publishing from Docbook 5 to
    > PDF, PostScript, RTF, and some variant of HTML (preferably xhtml
    > strict, but most any variant will work). Some of my testing "almost"
    > works via xsltproc using the sourceforge download for docbook.xsl, but
    > apparently what I need is the "xi" version, docbookxi.xsl, which I
    > have not been able to find. If I give up dividing into multiple files
    > vi XInclude, and instead use a DTD and entities, or else create one
    > large monolithic file, things work...however, this is very difficult
    > to work with...I'd end up going back to less desirable less flexible
    > tools.
    >
    > For use of Docbook 5 under Linux and xsltproc, where would I find a
    > suitable XInclude stylesheet (docbook.xsl)? Or is there some other
    > recommended route for processing Docbook 5 books while splitting into
    > separate files for each chapter?
    >

    No need for special XSLT. xsltproc will process XInclude on your input
    documents if you pass it the --xinclude option.

    --
    Shaun