docbook-apps

  • 1.  Removing newlines between

    Posted 08-19-2016 14:49
    Hello,

    I have a task to combine a single DocBook XML file from several other source DocBook XML files. This is done with some Perl script. Next, I'm trying to prettify the result (also from inside my Perl script) using the following xslt stylesheet:

    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:output method="xml" indent="yes" encoding="UTF-8"/>
    <xsl:strip-space elements="*"/>
    <xsl:template match="/">
    <xsl:copy-of select="."/>
    </xsl:template>
    </xsl:stylesheet>

    In this resulting XML, I get the following formatting:



    <informaltable>
    <tgroup cols="2">
    <colspec colname="col2" colnum="2" colwidth="4*"/>

    <row>
    <entry>Some text</entry>
    <entry>
    <para>Some text</para>
    <para>Some text</para>
    </entry>
    </row>

    </tgroup>
    </informaltable>


    But I need the <para>s inside the <entry> to stick together:



    <informaltable>
    <tgroup cols="2">
    <colspec colname="col2" colnum="2" colwidth="4*"/>

    <row>
    <entry>Some text</entry>
    <entry>
    <para>Some text</para><para>Some text</para>
    </entry>
    </row>

    </tgroup>
    </informaltable>


    Even if these <para>s are on the same line in my source file, in the combined file they jump to different lines because of the formatting and indenting.

    What changes shall I introduce in my xslt stylesheet to solve this?

    Thank you!

    --
    Best regards,

    Ekaterina Shikareva
    Senior Technical Writer


    ________________________________

    This e-mail and any attachment(s) are intended only for the recipient(s) named above and others who have been specifically authorized to receive them. They may contain confidential information. If you are not the intended recipient, please do not read this email or its attachment(s). Furthermore, you are hereby notified that any dissemination, distribution or copying of this e-mail and any attachment(s) is strictly prohibited. If you have received this e-mail in error, please immediately notify the sender by replying to this e-mail and then delete this e-mail and any attachment(s) or copies thereof from your system. Thank you.



  • 2.  Re: [docbook-apps] Removing newlines between

    Posted 08-22-2016 17:44
    Hi Ekaterina,
    I'm not completely clear on what you need here. In terms of DocBook
    XML, these two representations are semantically identical:

    <para>Some text</para>
    <para>Some text</para>

    and

    <para>Some text</para><para>Some text</para>

    That is, white space between block elements like para is not considered
    significant, and will be ignored in any further processing to generate
    output. So these two representations will produce identical output.

    If your cleanup XSLT includes <xsl:output indent="yes"/>, then that is a
    global setting and is the reason why the two paras are on separate
    lines. If you set indent="no", then those line breaks won't be added,
    but then line breaks won't be added anywhere. Turning off the line
    breaks only within <entry> might be accomplished if you use
    <xsl:preserve-space> and <xsl:strip-space> in some combination, but I
    haven't tried it.

    If instead you are asking that the content of the para elements be
    merged into a single para in the output, then that's a different thing.

    Bob Stayton
    Sagehill Enterprises
    bobs@sagehill.net

    On 8/19/2016 7:48 AM, Shikareva, Ekaterina wrote:
    > Hello,
    >
    >
    >
    > I have a task to combine a single DocBook XML file from several other
    > source DocBook XML files. This is done with some Perl script. Next, I’m
    > trying to prettify the result (also from inside my Perl script) using
    > the following xslt stylesheet:
    >
    >
    >
    > <xsl:stylesheet version="1.0"
    > xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    >
    > <xsl:output method="xml" indent="yes" encoding="UTF-8"/>
    >
    > <xsl:strip-space elements="*"/>
    >
    > <xsl:template match="/">
    >
    > <xsl:copy-of select="."/>
    >
    > </xsl:template>
    >
    > </xsl:stylesheet>
    >
    >
    >
    > In this resulting XML, I get the following formatting:
    >
    >
    >
    >

    >
    >
    >
    > <informaltable>
    >
    > <tgroup cols="2">
    >
    > <colspec colname="col2" colnum="2" colwidth="4*"/>
    >
    >
    >
    > <row>
    >
    > <entry>Some text</entry>
    >
    > <entry>
    >
    > <para>Some text</para>
    >
    > <para>Some text</para>
    >
    > </entry>
    >
    > </row>
    >
    >
    >
    > </tgroup>
    >
    > </informaltable>
    >
    >

    >
    >
    >
    > But I need the <para>s inside the <entry> to stick together:
    >
    >
    >
    >

    >
    >
    >
    > <informaltable>
    >
    > <tgroup cols="2">
    >
    > <colspec colname="col2" colnum="2" colwidth="4*"/>
    >
    >
    >
    > <row>
    >
    > <entry>Some text</entry>
    >
    > <entry>
    >
    > <para>Some text</para><para>Some text</para>
    >
    > </entry>
    >
    > </row>
    >
    >
    >
    > </tgroup>
    >
    > </informaltable>
    >
    >

    >
    >
    >
    > Even if these <para>s are on the same line in my source file, in the
    > combined file they jump to different lines because of the formatting and
    > indenting.
    >
    >
    >
    > What changes shall I introduce in my xslt stylesheet to solve this?
    >
    >
    >
    > Thank you!
    >
    >
    >
    > --
    >
    > Best regards,
    >
    >
    >
    > Ekaterina Shikareva
    >
    > Senior Technical Writer
    >
    >
    >
    >
    > ------------------------------------------------------------------------
    >
    > This e-mail and any attachment(s) are intended only for the recipient(s)
    > named above and others who have been specifically authorized to receive
    > them. They may contain confidential information. If you are not the
    > intended recipient, please do not read this email or its attachment(s).
    > Furthermore, you are hereby notified that any dissemination,
    > distribution or copying of this e-mail and any attachment(s) is strictly
    > prohibited. If you have received this e-mail in error, please
    > immediately notify the sender by replying to this e-mail and then delete
    > this e-mail and any attachment(s) or copies thereof from your system.
    > Thank you.



  • 3.  RE: [docbook-apps] Removing newlines between

    Posted 08-23-2016 07:51
    Hello Bob!

    Thank you for your answer.

    The funny thing about
    <para>Some text</para>
    <para>Some text</para>
    is that these paras are represented as two consecutive paragraphs when they are inside, for example, a
    .
    But when they are inside a table's (informaltable's in my case) entry, then an empty line is inserted between them for some reason.

    <para>Some text</para><para>Some text</para> - this variant is displayed as two consecutive paragraphs always, without any empty line between them either inside an informaltable or outside.

    Basically, the main goal was to get rid of this empty line in tables. It's a pity I can't insert screenshots in this message, it would be easier to explain :)

    We are fighting this empty line now with some more complicated Perl scripting, because preserving nice indenting is also an important task for us.

    --
    Ekaterina Shikareva.

    -----Original Message-----
    From: Bob Stayton [mailto:bobs@sagehill.net]
    Sent: Montag, 22. August 2016 19:44
    To: Shikareva, Ekaterina; docbook-apps@lists.oasis-open.org
    Subject: Re: [docbook-apps] Removing newlines between <para>s

    Hi Ekaterina,
    I'm not completely clear on what you need here. In terms of DocBook XML, these two representations are semantically identical:

    <para>Some text</para>
    <para>Some text</para>

    and

    <para>Some text</para><para>Some text</para>

    That is, white space between block elements like para is not considered significant, and will be ignored in any further processing to generate output. So these two representations will produce identical output.

    If your cleanup XSLT includes <xsl:output indent="yes"/>, then that is a global setting and is the reason why the two paras are on separate lines. If you set indent="no", then those line breaks won't be added, but then line breaks won't be added anywhere. Turning off the line breaks only within <entry> might be accomplished if you use <xsl:preserve-space> and <xsl:strip-space> in some combination, but I haven't tried it.

    If instead you are asking that the content of the para elements be merged into a single para in the output, then that's a different thing.

    Bob Stayton
    Sagehill Enterprises
    bobs@sagehill.net

    On 8/19/2016 7:48 AM, Shikareva, Ekaterina wrote:
    > Hello,
    >
    >
    >
    > I have a task to combine a single DocBook XML file from several other
    > source DocBook XML files. This is done with some Perl script. Next,
    > I'm trying to prettify the result (also from inside my Perl script)
    > using the following xslt stylesheet:
    >
    >
    >
    > <xsl:stylesheet version="1.0"
    > xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    >
    > <xsl:output method="xml" indent="yes" encoding="UTF-8"/>
    >
    > <xsl:strip-space elements="*"/>
    >
    > <xsl:template match="/">
    >
    > <xsl:copy-of select="."/>
    >
    > </xsl:template>
    >
    > </xsl:stylesheet>
    >
    >
    >
    > In this resulting XML, I get the following formatting:
    >
    >
    >
    >

    >
    >
    >
    > <informaltable>
    >
    > <tgroup cols="2">
    >
    > <colspec colname="col2" colnum="2" colwidth="4*"/>
    >
    >
    >
    > <row>
    >
    > <entry>Some text</entry>
    >
    > <entry>
    >
    > <para>Some text</para>
    >
    > <para>Some text</para>
    >
    > </entry>
    >
    > </row>
    >
    >
    >
    > </tgroup>
    >
    > </informaltable>
    >
    >

    >
    >
    >
    > But I need the <para>s inside the <entry> to stick together:
    >
    >
    >
    >

    >
    >
    >
    > <informaltable>
    >
    > <tgroup cols="2">
    >
    > <colspec colname="col2" colnum="2" colwidth="4*"/>
    >
    >
    >
    > <row>
    >
    > <entry>Some text</entry>
    >
    > <entry>
    >
    > <para>Some text</para><para>Some text</para>
    >
    > </entry>
    >
    > </row>
    >
    >
    >
    > </tgroup>
    >
    > </informaltable>
    >
    >

    >
    >
    >
    > Even if these <para>s are on the same line in my source file, in the
    > combined file they jump to different lines because of the formatting
    > and indenting.
    >
    >
    >
    > What changes shall I introduce in my xslt stylesheet to solve this?
    >
    >
    >
    > Thank you!
    >
    >
    >
    > --
    >
    > Best regards,
    >
    >
    >
    > Ekaterina Shikareva
    >
    > Senior Technical Writer
    >
    >
    >
    >
    > ----------------------------------------------------------------------
    > --
    >
    > This e-mail and any attachment(s) are intended only for the
    > recipient(s) named above and others who have been specifically
    > authorized to receive them. They may contain confidential information.
    > If you are not the intended recipient, please do not read this email or its attachment(s).
    > Furthermore, you are hereby notified that any dissemination,
    > distribution or copying of this e-mail and any attachment(s) is
    > strictly prohibited. If you have received this e-mail in error, please
    > immediately notify the sender by replying to this e-mail and then
    > delete this e-mail and any attachment(s) or copies thereof from your system.
    > Thank you.

    ________________________________

    This e-mail and any attachment(s) are intended only for the recipient(s) named above and others who have been specifically authorized to receive them. They may contain confidential information. If you are not the intended recipient, please do not read this email or its attachment(s). Furthermore, you are hereby notified that any dissemination, distribution or copying of this e-mail and any attachment(s) is strictly prohibited. If you have received this e-mail in error, please immediately notify the sender by replying to this e-mail and then delete this e-mail and any attachment(s) or copies thereof from your system. Thank you.



  • 4.  Re: [docbook-apps] Removing newlines between

    Posted 08-23-2016 16:17
    Yes, that is funny, as in funny strange. With the stock DocBook XSL
    stylesheets, my output to PDF using FOP 1.1 shows a blank line between
    paras, in both cases. Removing the line break between paras does not
    remove the blank line in the output.

    So I would like to ask about how you are processing your document, and
    whether you have customized the DocBook stylesheet to generate your
    output. If you want to send me your stylesheet customization off list I
    could take a look.

    Bob Stayton
    Sagehill Enterprises
    bobs@sagehill.net

    On 8/23/2016 12:50 AM, Shikareva, Ekaterina wrote:
    > Hello Bob!
    >
    > Thank you for your answer.
    >
    > The funny thing about <para>Some text</para> <para>Some text</para>
    > is that these paras are represented as two consecutive paragraphs
    > when they are inside, for example, a
    . But when they are
    > inside a table's (informaltable's in my case) entry, then an empty
    > line is inserted between them for some reason.
    >
    > <para>Some text</para><para>Some text</para> - this variant is
    > displayed as two consecutive paragraphs always, without any empty
    > line between them either inside an informaltable or outside.
    >
    > Basically, the main goal was to get rid of this empty line in tables.
    > It's a pity I can't insert screenshots in this message, it would be
    > easier to explain :)
    >
    > We are fighting this empty line now with some more complicated Perl
    > scripting, because preserving nice indenting is also an important
    > task for us.
    >
    > -- Ekaterina Shikareva.
    >
    > -----Original Message----- From: Bob Stayton
    > [mailto:bobs@sagehill.net] Sent: Montag, 22. August 2016 19:44 To:
    > Shikareva, Ekaterina; docbook-apps@lists.oasis-open.org Subject: Re:
    > [docbook-apps] Removing newlines between <para>s
    >
    > Hi Ekaterina, I'm not completely clear on what you need here. In
    > terms of DocBook XML, these two representations are semantically
    > identical:
    >
    > <para>Some text</para> <para>Some text</para>
    >
    > and
    >
    > <para>Some text</para><para>Some text</para>
    >
    > That is, white space between block elements like para is not
    > considered significant, and will be ignored in any further processing
    > to generate output. So these two representations will produce
    > identical output.
    >
    > If your cleanup XSLT includes <xsl:output indent="yes"/>, then that
    > is a global setting and is the reason why the two paras are on
    > separate lines. If you set indent="no", then those line breaks won't
    > be added, but then line breaks won't be added anywhere. Turning off
    > the line breaks only within <entry> might be accomplished if you use
    > <xsl:preserve-space> and <xsl:strip-space> in some combination, but I
    > haven't tried it.
    >
    > If instead you are asking that the content of the para elements be
    > merged into a single para in the output, then that's a different
    > thing.
    >
    > Bob Stayton Sagehill Enterprises bobs@sagehill.net
    >
    > On 8/19/2016 7:48 AM, Shikareva, Ekaterina wrote:
    >> Hello,
    >>
    >>
    >>
    >> I have a task to combine a single DocBook XML file from several
    >> other source DocBook XML files. This is done with some Perl script.
    >> Next, I'm trying to prettify the result (also from inside my Perl
    >> script) using the following xslt stylesheet:
    >>
    >>
    >>
    >> <xsl:stylesheet version="1.0"
    >> xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    >>
    >> <xsl:output method="xml" indent="yes" encoding="UTF-8"/>
    >>
    >> <xsl:strip-space elements="*"/>
    >>
    >> <xsl:template match="/">
    >>
    >> <xsl:copy-of select="."/>
    >>
    >> </xsl:template>
    >>
    >> </xsl:stylesheet>
    >>
    >>
    >>
    >> In this resulting XML, I get the following formatting:
    >>
    >>
    >>
    >>

    >>
    >>
    >>
    >> <informaltable>
    >>
    >> <tgroup cols="2">
    >>
    >> <colspec colname="col2" colnum="2" colwidth="4*"/>
    >>
    >>
    >>
    >> <row>
    >>
    >> <entry>Some text</entry>
    >>
    >> <entry>
    >>
    >> <para>Some text</para>
    >>
    >> <para>Some text</para>
    >>
    >> </entry>
    >>
    >> </row>
    >>
    >>
    >>
    >> </tgroup>
    >>
    >> </informaltable>
    >>
    >>

    >>
    >>
    >>
    >> But I need the <para>s inside the <entry> to stick together:
    >>
    >>
    >>
    >>

    >>
    >>
    >>
    >> <informaltable>
    >>
    >> <tgroup cols="2">
    >>
    >> <colspec colname="col2" colnum="2" colwidth="4*"/>
    >>
    >>
    >>
    >> <row>
    >>
    >> <entry>Some text</entry>
    >>
    >> <entry>
    >>
    >> <para>Some text</para><para>Some text</para>
    >>
    >> </entry>
    >>
    >> </row>
    >>
    >>
    >>
    >> </tgroup>
    >>
    >> </informaltable>
    >>
    >>

    >>
    >>
    >>
    >> Even if these <para>s are on the same line in my source file, in
    >> the combined file they jump to different lines because of the
    >> formatting and indenting.
    >>
    >>
    >>
    >> What changes shall I introduce in my xslt stylesheet to solve
    >> this?
    >>
    >>
    >>
    >> Thank you!
    >>
    >>
    >>
    >> --
    >>
    >> Best regards,
    >>
    >>
    >>
    >> Ekaterina Shikareva
    >>
    >> Senior Technical Writer
    >>
    >>
    >>
    >>
    >> ----------------------------------------------------------------------
    >>
    >>
    --
    >>
    >> This e-mail and any attachment(s) are intended only for the
    >> recipient(s) named above and others who have been specifically
    >> authorized to receive them. They may contain confidential
    >> information. If you are not the intended recipient, please do not
    >> read this email or its attachment(s). Furthermore, you are hereby
    >> notified that any dissemination, distribution or copying of this
    >> e-mail and any attachment(s) is strictly prohibited. If you have
    >> received this e-mail in error, please immediately notify the sender
    >> by replying to this e-mail and then delete this e-mail and any
    >> attachment(s) or copies thereof from your system. Thank you.
    >
    > ________________________________
    >
    > This e-mail and any attachment(s) are intended only for the
    > recipient(s) named above and others who have been specifically
    > authorized to receive them. They may contain confidential
    > information. If you are not the intended recipient, please do not
    > read this email or its attachment(s). Furthermore, you are hereby
    > notified that any dissemination, distribution or copying of this
    > e-mail and any attachment(s) is strictly prohibited. If you have
    > received this e-mail in error, please immediately notify the sender
    > by replying to this e-mail and then delete this e-mail and any
    > attachment(s) or copies thereof from your system. Thank you.
    >
    >