Forum How do I...?

Generating a preceding heading?

jean
Hi there

I want to do this:

div.toc::before {
    content: "<h1>Table of Contents</h1>"
}


Problem is that the H1s aren't parsed. How to fix .. ?
mikeday
You can't, but you can create something that is styled the same:
div.toc::before {
    content: "Table of Contents";
    display: block;
    font: bold large sans-serif;
    prince-bookmark-level: 1
    ...
}

To actually create the physical element would require a preprocessing step using XSLT or Perl or similar.
jean
mikeday wrote:
You can't, but you can create something that is styled the same:


Oh wow :D

Thank you .. (I was just going off reading about customising DocBook HTML generation XSLT).
mikeday
By the way, to see the default styling rules for HTML elements, check xhtml.css in the style directory of the Prince installation.
jean
I have a section that starts like this:

<div>
  <h3 class="title">
    <a name="d4e355"></a>
    3.2.&nbsp;<em class="glossterm">
    <a name="this__term"></a>This</em> thing</h3>
  ...


Now the problem is that the header is followed by a list. I've configured lists to avoid page breaks inside, which is fine. but in this case we have:

3.1.2 Small title
  short section
3.2 Bigger title
  <big ugly gap  :( >


with the list following on the next page. The small title followed by the big title and a lot of whitespace is ugggly.

This doesn't work:

a[name="d4e355"] {
    page-break-before: always;
    content: "asdfsadfsadfsadf"
}


although the content does get inserted in the right place. I also tried to select the list to tell it it's OK to break, but can't see how to get hold of it since I want "the div.variablelist sibling of the h3 element which contains the a element named d4e355".

I think I need to insert the break before the H3, but I don't think CSS selectors allow that .. advice?
mikeday
Why not just "page-break-after: avoid" on the h3 element?