#1145 empty <div class="titlepage/> messes up css in XHTML output

output: HTML
open
XSL (1066)
5
2011-01-05
2010-10-08
No

Hi, I'm running the normal docbook xsl and using docbook-xsl-1.76.1-RC1/epub/docbook.xsl"/>

I've noticed extra div tags popping up which ruin the styles..You can see this in action in the OEBPS/ch02.html file

INPUT:

<sidebar>
<para> first sentence of sidebar </para>
<para>second sentence of sidebar</para>
</sidebar>
<para>In the current hydrocarbon economy, transportation is fueled primarily by petroleum.
Burning of hydrocarbon fuels emits carbon dioxide and other pollutants. The supply of
economically usable hydrocarbon resources in the world is limited, and the demand for
hydrocarbon fuels is increasing, particularly in China, India and other developing
countries.</para>

OUTPUT:
<div class="sidebar"><div class="titlepage"/>
<p> first sentence of sidebar </p>
<p>second sentence of sidebar</p>

</div>
<p>In the current hydrocarbon economy, transportation is fueled primarily by petroleum.
Burning of hydrocarbon fuels emits carbon dioxide and other pollutants. The supply of
economically usable hydrocarbon resources in the world is limited, and the demand for
hydrocarbon fuels is increasing, particularly in China, India and other developing
countries.</p>

I also see at the top of the document: <body><div class="chapter" title="Chapter 2. second test"><div class="titlepage"><div><div><h1 class="title"><a id="test2"/>Chapter 2. second test </h1></div></div></div>

I'm not sure why the Firefox/Chrome browsers do this, but the extra div tags in sidebar causes the browsers to use the style from div.class="sidebar" even after the div tag is closed.

Discussion

  • Robert Nagle

    Robert Nagle - 2010-10-08

    sorry, the zip file didn't contain the customization layer. I added it as a second attachment. testepub.xsl

     
  • Robert Nagle

    Robert Nagle - 2010-10-08

    testepub.xsl

     
  • Robert Nagle

    Robert Nagle - 2010-10-08

    One more thing. I wish to state why this bug is bothersome. Inserting that extra bug causes (in Firefox and Chrome at least) the css for div.sidebar to be applied to the remainder of the document, so it breaks the css......

    You can verify this by looking at the OEPBS/ch02.html file.

    This seems to be related to the https://sourceforge.net/tracker/?func=detail&aid=3014425&group_id=21935&atid=373747 bug.

     
  • Keith Fahlgren

    Keith Fahlgren - 2010-10-13
    • labels: 1168228 --> XSL
     
  • Keith Fahlgren

    Keith Fahlgren - 2010-10-13

    This is an (X)HTML issue rather than just an EPUB one.

    1.75.2 outputs

    <div class="sidebar"><p class="title"><b></b></p>

    1.76.1-RC1 outputs

    <div class="sidebar"><div class="titlepage"></div>

    What do you think should be outputted?

     
  • Keith Fahlgren

    Keith Fahlgren - 2010-10-13
    • milestone: 895397 --> output: HTML
     
  • Robert Nagle

    Robert Nagle - 2010-10-14

    If I do not include a <title> element inside sidebar, I would not expect <p class="title"> or <p class="titlepage"> to be anywhere; it should simply be a <p>.

    In the web browser, the presence of that empty div causes the style of the div.sidebar to continue beyond the ending of the sidebar.div tag. So in my test project with my css, the rest of the text after the sidebar is automatically given an olive color.

    If a nonexistent title element caused this to be spit out: <div class="sidebar"><p class="title"><b></b></p>, that would not break the css.

    But if it spits out <div class="sidebar"><div class="titlepage"></div>, then the css will break.

    Personally I have no idea why an empty div tag would disrupt the css so much. it makes no sense. My first guess is that it's a browser bug, but Firefox/IE/Chrome all show the same strangeness.

    Please note that if I include a <title> element here with a value,the CSS renders everything fine.

    The rule should be: if no title is included inside a sidebar, then the div that would normally appear containing the title value should be omitted altogether.

     
  • Robert Nagle

    Robert Nagle - 2010-10-14

    bad-rendered-html-screenshot.png

     
  • Robert Nagle

    Robert Nagle - 2011-01-05

    Update: This problem is the result of <div class="titlepage"/> being an empty tag; it reliably messes up browsers.

    One workaround for XHTML output is to use this parameter:

    <xsl:param name="chunker.output.method">saxon:xhtml</xsl:param>

    However, I don't use saxon when running db2epub.py (it uses lxml), so this statement wouldn't do anything.

     
  • Robert Nagle

    Robert Nagle - 2011-01-05
    • summary: extra
      --> empty
     

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.





No, thanks