docbook-apps

  • 1.  Re: Some beginner questions for db xslt20-stylesheets

    Posted 12-17-2018 08:12
    aanno <aannoaanno@gmail.com> writes:
    > 1. So far I have used 'java -jar docbook-xslt2-2.3.8.jar -f foprint -o
    > out.fo howto.xml' to get an PDF of my document. However, I wonder if
    > it is possible to get the _xsl-fo output_ of the document as well.
    > There seems to be a lot of options (and I have played around with
    > 'return-secondary' but with no useful result), so perhaps this is easy.

    I think you’d have to modify the pipeline to do that.

    > 2. When I try the '(css)print' format, I only get the error:
    > 'XProcException: No CSS processor class defined'. I guess I'm
    > missing something here.

    Right. You need a tool to do CSS printing. I believe you can use
    either AntennaHouse or Prince, but I confess I haven’t tried anything
    but AntennaHouse recentluy.

    > 3. What are my options for using _math_ inside a docbook document?

    You can put MathML in an inlineequation. Successful output is going
    to depend on a processor that can render MathML, of course.

    If you’ve got a tool that can turn MathML into bitmaps, you could
    construct a pipeline to do that, I expect.

    > 4. Is it possible to do source code highlighting in docbook?

    In the browser, yes. I don’t think there’s a solution for doing it in
    print at the moment.

    Be seeing you,
    norm

    --
    Norman Walsh <ndw@nwalsh.com> | So, are you working on finding that bug
    http://nwalsh.com/ | now, or are you leaving it until later?
    | Yes.



  • 2.  Re: [docbook-apps] Re: Some beginner questions for db xslt20-stylesheets

    Posted 12-17-2018 11:18
    On 17.12.2018 9:11, Norman Walsh wrote:
    >> 4. Is it possible to do source code highlighting in docbook?
    >
    > In the browser, yes. I don’t think there’s a solution for doing it in
    > print at the moment.

    XSLTH library (https://sourceforge.net/projects/xslthl/) used by XSLT
    1.0 stylesheets has Saxon9 connector, so in theory it can be integrated
    into XSLT 2.0 styleshets as well.

    --
    ------------------------------------------------------------------
    Jirka Kosek e-mail: jirka@kosek.cz http://xmlguru.cz
    ------------------------------------------------------------------
    Professional XML and Web consulting and training services
    DocBook/DITA customization, custom XSLT/XSL-FO document processing
    ------------------------------------------------------------------
    Bringing you XML Prague conference http://xmlprague.cz
    ------------------------------------------------------------------




  • 3.  AW: [docbook-apps] Re: Some beginner questions for db xslt20-stylesheets

    Posted 12-17-2018 11:51
    Hi,

    oXygen comes with a DITA Open Toolkit plugin that integrates the XSLTH library for PDF output. Perhaps you can borrow some ideas from there.

    http://blog.oxygenxml.com/2013/12/creating-simple-dita-open-toolkit.html

    Best regards,
    Frank



    Frank Ralf
    Technical Consultant

    parson AG

    -----Ursprüngliche Nachricht-----
    Von: Jirka Kosek <jirka@kosek.cz>
    Gesendet: Montag, 17. Dezember 2018 12:18
    An: Norman Walsh <ndw@nwalsh.com>; docbook-apps@lists.oasis-open.org
    Betreff: Re: [docbook-apps] Re: Some beginner questions for db xslt20-stylesheets

    On 17.12.2018 9:11, Norman Walsh wrote:
    >> 4. Is it possible to do source code highlighting in docbook?
    >
    > In the browser, yes. I don’t think there’s a solution for doing it in
    > print at the moment.

    XSLTH library (https://sourceforge.net/projects/xslthl/) used by XSLT
    1.0 stylesheets has Saxon9 connector, so in theory it can be integrated into XSLT 2.0 styleshets as well.

    --
    ------------------------------------------------------------------
    Jirka Kosek e-mail: jirka@kosek.cz http://xmlguru.cz
    ------------------------------------------------------------------
    Professional XML and Web consulting and training services DocBook/DITA customization, custom XSLT/XSL-FO document processing
    ------------------------------------------------------------------
    Bringing you XML Prague conference http://xmlprague.cz
    ------------------------------------------------------------------




  • 4.  Re: [docbook-apps] Re: Some beginner questions for db xslt20-stylesheets

    Posted 12-17-2018 13:12
    On 17/12/2018 11:18, Jirka Kosek wrote:
    > On 17.12.2018 9:11, Norman Walsh wrote:
    >>> 4. Is it possible to do source code highlighting in docbook?
    >>
    >> In the browser, yes. I don’t think there’s a solution for doing it
    >> in print at the moment.
    >
    > XSLTH library (https://sourceforge.net/projects/xslthl/) used by
    > XSLT 1.0 stylesheets has Saxon9 connector, so in theory it can be
    > integrated into XSLT 2.0 styleshets as well.

    Easily more than just a theory. I used the XSLTHL library and an XSLT
    2.0 stylesheet to add highlighting (to HTML) in the current version of
    'Introduction to CSS for Paged Media' available at
    https://www.antennahouse.com/css/.

    The significant parts of the stylesheet (based on the XSLTHL example) are:

    ----------------------------------------------
    <xsl:stylesheet
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    version="2.0"

    xmlns="http://www.w3.org/1999/xhtml"
    xmlns:sbhl="http://net.sf.xslthl/ConnectorSaxonB"
    xmlns:saxonb="http://saxon.sf.net/"
    xmlns:xslthl="http://xslthl.sf.net"
    xmlns:xhtml="http://www.w3.org/1999/xhtml"
    xmlns:xs="http://www.w3.org/2001/XMLSchema"
    extension-element-prefixes="sbhl xslthl"
    exclude-result-prefixes="saxonb sbhl xhtml xs xslthl">


    <xsl:param name="xslthl.config" />


    <saxonb:script implements-prefix="sbhl" language="java"
    src="java:net.sf.xslthl.ConnectorSaxonB" />

    <xsl:template match="xhtml:code[@class] | xhtml:pre[@class]">
    <xsl:element name="{local-name()}">
    <xsl:copy-of select="@*" />
    <xsl:call-template name="syntax-highlight">
    <xsl:with-param name="language"
    select="tokenize(normalize-space(@class),
    ' ')[last()]"
    as="xs:string"
    tunnel="yes" />
    <xsl:with-param name="source" select="." />
    </xsl:call-template>
    </xsl:element>
    </xsl:template>


    <xsl:template match="xslthl:*" mode="hl">

    <xsl:apply-templates select="node()" />

    </xsl:template>


    <xsl:template name="syntax-highlight">
    <xsl:param name="language" as="xs:string" tunnel="yes" />
    <xsl:param name="source" />
    <xsl:choose>
    <xsl:when test="function-available('sbhl:highlight')">
    <xsl:variable name="highlighted"
    select="sbhl:highlight($language, $source,
    $xslthl.config)" />
    <xsl:apply-templates select="$highlighted" mode="hl" />
    </xsl:when>
    <xsl:otherwise>
    style="border: 2px solid red; background: white; font-family:
    sans-serif; padding: 0.5em; font-size: 2em;"
    >No syntax highlighter available

    <xsl:apply-templates select="$source/* | $source/text()" />
    </xsl:otherwise>
    </xsl:choose>
    </xsl:template>
    ----------------------------------------------

    I use Ant to run nearly everything, so if you want to reconstruct the
    usage, this is the Ant command line:

    ant -lib xslthl-2.1.3.jar -lib saxon9.jar -emacs toc-hl.single

    where the 'toc-hl.single' target uses the <xslt> target to run Saxon and
    on the stylesheet and pass in the XSLTHL configuration file as a
    parameter.

    I hope that helps.

    Regards,


    Tony Graham.
    --
    Senior Architect
    XML Division
    Antenna House, Inc.
    ----
    Skerries, Ireland
    tgraham@antenna.co.jp



  • 5.  Re: [docbook-apps] Re: Some beginner questions for db xslt20-stylesheets

    Posted 12-20-2018 13:25
    > aanno <aannoaanno@gmail.com> writes:
    >> 1. So far I have used 'java -jar docbook-xslt2-2.3.8.jar -f foprint -o
    >> out.fo howto.xml' to get an PDF of my document. However, I wonder if
    >> it is possible to get the _xsl-fo output_ of the document as well.
    >> There seems to be a lot of options (and I have played around with
    >> 'return-secondary' but with no useful result), so perhaps this is easy.
    > I think you’d have to modify the pipeline to do that.
    Using '-f fo' is undocumented, but gets the job done.
    >
    >> 2. When I try the '(css)print' format, I only get the error:
    >> 'XProcException: No CSS processor class defined'. I guess I'm
    >> missing something here.
    > Right. You need a tool to do CSS printing. I believe you can use
    > either AntennaHouse or Prince, but I confess I haven’t tried anything
    > but AntennaHouse recentluy.

    With Prince XML as css print processor:

    * Install prince from https://www.princexml.com/
    * Use 2 system properties for calabash configuration:
             -Dcom.xmlcalabash.css-processor=com.xmlcalabash.util.CssPrince
             -Dcom.xmlcalabash.css.prince.exepath=/usr/bin/prince

    >
    >> 3. What are my options for using _math_ inside a docbook document?
    > You can put MathML in an inlineequation. Successful output is going
    > to depend on a processor that can render MathML, of course.
    >
    > If you’ve got a tool that can turn MathML into bitmaps, you could
    > construct a pipeline to do that, I expect.
    I'm fiddling with mathjax generated SVG's now and will post a separate
    question about this.
    >
    >> 4. Is it possible to do source code highlighting in docbook?
    > In the browser, yes. I don’t think there’s a solution for doing it in
    > print at the moment.
    >
    > Be seeing you,
    > norm
    >

    --
    Mit freundlichen Grüßen / Best regards,

    Thomas Pasch
    Entwickler, Dipl.-Ing.

    *SiteOS AG*
    Grillparzerstraße 10
    81675 München

    /Tel/: +49 89 / 30 90 897 21
    /Fax/: +49 89 / 30 90 897 99
    /E-Mail/: Thomas.Pasch@SiteOS.de

    /Vorstand/: Andreas Germeroth, Thomas Reischl
    /Vorsitzender des Aufsichtsrats/: Dr. Nicolas Martin
    /Registergericht München/ | Registernummer: HR B 130513

    Diese E-Mail enthält vertrauliche und/oder rechtlich geschützte
    Informationen. Wenn Sie nicht der richtige Adressat sind oder diese
    E-Mail irrtümlich erhalten haben,informieren Sie bitte sofort den
    Absender und vernichten Sie diese Mail. Das unerlaubte Kopieren sowie
    die unbefugte Weitergabe dieser Mail ist nicht gestattet.

    This e-mail may contain confidential and/or privileged information. If
    you are not the intended recipient (or have received this e-mail in
    error) please notify the sender immediately and destroy this e-mail. Any
    unauthorised copying, disclosure or distribution of the material
    contained in this e-mail is strictly forbidden.