OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

docbook-apps message

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]


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:



    <section>

      <title>Title</title>

      <informaltable>

        <tgroup cols="2">

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

          <tbody>

            <row>

              <entry>Some text</entry>

              <entry>

                <para>Some text</para>

                <para>Some text</para>

              </entry>

            </row>

          </tbody>

        </tgroup>

      </informaltable>

    </section>



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



    <section>

      <title>Title</title>

      <informaltable>

        <tgroup cols="2">

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

          <tbody>

            <row>

              <entry>Some text</entry>

              <entry>

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

              </entry>

            </row>

          </tbody>

        </tgroup>

      </informaltable>

    </section>



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.


[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]