[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]
Subject: Re: [docbook] Float next to section title
Hi Bob,
Thanks a lot for your hints. Your solution works fine, if there is only a float next to one section title (or alternating title with float and without).
However, if a section with a float next to it follows another such section, the "clear" attribute no longer helps.
A minimal example might be a lot more descriptive in this case.
my_doc.xml
<?xml version="1.0" encoding="UTF-8"?>
<article xmlns="http://docbook.org/ns/docbook" version="5.0">
<title>Minimal Example</title>
<section>
<title>First section</title>
<figure float="right">
<title>DocBook 5</title>
<mediaobject>
<imageobject>
<imagedata fileref="http://docbook.org/graphics/smallcover.gif" format="GIF" />
</imageobject>
</mediaobject>
</figure>
<para>A bit of text ...</para>
</section>
<section>
<title>Second section</title>
<figure float="right">
<title>DocBook XSL</title>
<mediaobject>
<imageobject>
<imagedata fileref="http://docbook.org/graphics/xslcover.png" format="PNG" />
http://docbook.org/graphics/xslcover.png
</imageobject>
</mediaobject>
</figure>
<para>More text ...</para>
</section>
</article>
my_style.xsl
<?xml version='1.0'?>
<xsl:stylesheet
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:fo="http://www.w3.org/1999/XSL/Format"
xmlns:db="http://docbook.org/ns/docbook"
version="1.0">
<xsl:import href="http://docbook.sourceforge.net/release/xsl/current/html/docbook.xsl"/>
<xsl:attribute-set name="section.title.properties">
<xsl:attribute name="clear">both</xsl:attribute>
</xsl:attribute-set>
<xsl:param name="formal.title.placement">figure after</xsl:param>
</xsl:stylesheet>
I thought about customly changing the html output and indeed, if the image-<div> is preceding the title-<div>, the image is positioned next to the title if I use clear="none". However, this only works for the first section and makes the HTML code a bit confusing.
Therefore, I would be grateful for any hint towards a solution.
Kind regards,
Julia
> Hi Julia,
> I think clear would work here. The tricky thing about clear is that it
> must be applied to the div that *follows* the one you want to appear
> next to the float. In a customization, that would typically mean
> putting clear="both" on all section titles *except* the one you want to
> position next to the image, which should have clear="none".
>
> You might try experimenting by manually editing an HTML file and
> reloading it in the browser until you get the results you want, and then
> figure out how to implement that in a CSS stylesheet.
>
> Customizing CSS generally means customizing the class attribute on an
> element, and then writing CSS styles in a separate CSS stylesheet file
> that match on that class value. See this reference for more on CSS and
> class values:
>
> http://www.sagehill.net/docbookxsl/HtmlCustomEx.html#CustomClassValues
>
> BTW, for future reference, the docbook-apps mailing list is a better one
> for asking stylesheet questions. The docbook list is for discussion of
> the docbook schemas.
>
> Bob Stayton
> Sagehill Enterprises
> bobs@sagehill.net
>
> On 2/2/2014 12:35 PM, julia.jacobson@arcor.de wrote:
> > Hello everybody out there using DocBook,
> >
> > Is there a way to position a float right next to the title of a section
> but prevent the next section title to be placed next to a float of the
> previous section?
> > I know about the "clear" parameter but this does not enable me to place a
> float from one section next to the corresponding title without placing the
> title of the next section next to the same float in case the section is
> short.
> > Sorry for placing another question so soon after my previous one to this
> list, but I just began using DocBook and could not find an solution for my
> problem despite extensive web search.
> >
> > Kind regards,
> > Julia
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: docbook-unsubscribe@lists.oasis-open.org
> > For additional commands, e-mail: docbook-help@lists.oasis-open.org
> >
> >
> >
> >
>
[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]