docbook-apps

  • 1.  Text style and color

    Posted 03-26-2007 17:52
    Hi all,

    I have to produce documents with a complex presentation for some part of the
    text.

    My toolchain consists in :
    XML (with owner format) --|XSLT|--> DocBook --|docbook-xsl|--> PDF

    In my source XML document, there is some data where format description is part
    of the data.
    eg.
    <xxx>
    <txt>
    <color>blue</color>

    <wording>A part of</wording>
    </txt>
    <txt>
    <color>black</color>

    <wording> a text for xxx</wording>
    </txt>
    </xxx>

    In my final PDF document, I want to display xxx elements with a pretty format
    representing a concatenation of txt (taking into account color and style
    sub-elements).

    For this purpose, I think I have two choices, but I'm not sure the first is
    possible :

    1/ Generating a docbook document with color and style inside. I don't find any
    documentation about customizing text color in docbook (i.e. without developping
    it in my customization layer). Is it possible to do this ?

    2/ Generating a docbook document with "xxx" elements inside and treating them in
    the presentation layer. This means that my docbook format is extented with the
    "xxx" element. Regarding the reference schema of DocBook publishing
    model(http://nwalsh.com/docbook/procdiagram/) I guess it is possible. Is there a
    documentation guide for extending DocBook format with owner elements ?

    Thanks in advance.

    Xavier




  • 2.  Re: [docbook-apps] Text style and color

    Posted 03-26-2007 21:05
    Hi Xavier,

    I think you're going to be stuck with writing a customization layer to do
    any of this. I'm not quite sure what you mean by "customizing text color
    ... without developing it in my customization layer." You simply can't
    customize such properties without putting them in a customization layer.

    If you need to have new elements such as <xxx> and <txt> in your DocBook
    document, then you will have to first customize DocBook to add them. See
    the relevant chapter of the Definitive Guide:
    http://docbook.org/tdg/en/html/ch05.html.

    Then, you will have to write a stylesheet customization layer to treat these
    elements accordingly:

    <xsl:template match="xxx">
    <fo:block>
    <xsl:apply-templates/>
    </fo:block>
    </xsl:template>

    <xsl:template match="txt">
    <fo:inline>
    <xsl:attribute name="color">
    <xsl:apply-templates select="color"/>
    </xsl:attribute>
    <xsl:attribute name="font-style">
    <xsl:apply-templates select="style"/>
    </xsl:attribute>
    <xsl:text>
    <xsl:apply-templates select="wording"/>
    </xsl:text>
    </fo:inline>
    </xsl:template>

    Note: this is assuming you're using XSL-FO, and this may not be exactly how
    you want to do it, but it's an example.

    Hope this helps... let me know if I've misinterpreted your question.

    Colin

    On 3/26/07, xav.dev@free.fr <xav.dev@free.fr> wrote:
    >
    > Hi all,
    >
    > I have to produce documents with a complex presentation for some part of
    > the
    > text.
    >
    > My toolchain consists in :
    > XML (with owner format) --|XSLT|--> DocBook --|docbook-xsl|--> PDF
    >
    > In my source XML document, there is some data where format description is
    > part
    > of the data.
    > eg.
    > <xxx>
    > <txt>
    > <color>blue</color>
    >
    > <wording>A part of</wording>
    > </txt>
    > <txt>
    > <color>black</color>
    >
    > <wording> a text for xxx</wording>
    > </txt>
    > </xxx>
    >
    > In my final PDF document, I want to display xxx elements with a pretty
    > format
    > representing a concatenation of txt (taking into account color and style
    > sub-elements).
    >
    > For this purpose, I think I have two choices, but I'm not sure the first
    > is
    > possible :
    >
    > 1/ Generating a docbook document with color and style inside. I don't find
    > any
    > documentation about customizing text color in docbook (i.e. without
    > developping
    > it in my customization layer). Is it possible to do this ?
    >
    > 2/ Generating a docbook document with "xxx" elements inside and treating
    > them in
    > the presentation layer. This means that my docbook format is extented with
    > the
    > "xxx" element. Regarding the reference schema of DocBook publishing
    > model(http://nwalsh.com/docbook/procdiagram/) I guess it is possible. Is
    > there a
    > documentation guide for extending DocBook format with owner elements ?
    >
    > Thanks in advance.
    >
    > Xavier
    >
    >
    > ---------------------------------------------------------------------
    > To unsubscribe, e-mail: docbook-apps-unsubscribe@lists.oasis-open.org
    > For additional commands, e-mail: docbook-apps-help@lists.oasis-open.org
    >
    >