Forum How do I...?

help with headers

mark_anderson_us
Hi All

I'm just finishing up my first XSL that uses prince. Got auto-toc generaed which I'm real pleased about but have a few problems with headers.

Each chapter has a @ref attribute (the chapter name) and I need this to appear in the header on every page.

e.g. <Chapter ref="Agreement">

My xsl contains the following:

 
xsl:template match="Chapter">
        <div id="header" class="header">
            <h2 class="wide caps">
                <xsl:value-of select="@ref"/>
            </h2>
            <hr class="header"/>
        </div>
</xsl:template>


My CSS contains:

 @top {
              content: flow(header);
                   }

#header {flow: static(header);


I have two problems:

Duplicate ID's
I get an error saying that id "header" already exists (because there are 3 chapters, it's in the HTML 3 times). How can I eliminate this duplicate id error?
Alternatively, is there another way to get the chapter name in the header with a 2px grey rule beneath it

No TOC Header
I want my TOC page to have the same header style as the other pages and read "Table of Contents" where the chapter name normally appears. How can I achieve this?

Thanks in advance

mark
jim_albright
remove this. It isn't needed.
id="header"

In CSS use
.header {flow: static(header);

instead of

#header {flow: static(header);

Jim Albright
Wycliffe Bible Translators

mark_anderson_us
Thanks Jim

Solved my id problem

just got to figure out how to get the same style header on my TOC page

Regards

mark
jim_albright
I'm currently making a PowerPoint presentation that explains how to debug CSS.

One of the first rules is: Only fix one problem at a time. Glad the first problem is fixed.

So now to get the TOC with a header. How about letting me see some code if the following doesn't help.

You might want to have a TOC page that you can format

CSS:
@page TOC {
@top-center {
content: "Table of Contents"
border-bottom: solid ;
}
}

HTML:
div.TOC {
page: TOC ;
}

Jim Albright
Wycliffe Bible Translators

mark_anderson_us
Thanks for reply jim

I did something similar. my header is in a div and is taken our of normal flow, so i wanted do same for TOC (so style is exactly same). I made a TOC page and created a static div with page: toc in css

Only thing I don't like about it is I essentially have two copies of the header: one with a the section name from xsl:value-of and one with a literal string.

 <div class="header">
                        <h2 class="wide caps">Table of Contents</h2>
                        <hr class="header"/>
                    </div>

<div class="header">
            <h2 class="wide caps">
                <xsl:value-of select="@ref"/>
            </h2>
            <hr class="header"/>
        </div>


Not a lot of code I know, but I hate having duplicate code (one more thing to remember to change if either changes)

I tried uploading files before and it didn;t seem to accept any attachments. I could e-mail you my stuff if you want

Regards

mark
jim_albright
You can just use this one div.
<div class="header">
                        <h2 class="wide caps">Table of Contents</h2>
                        <hr class="header"/>
</div>



That has all you need for your header.

Jim Albright
Wycliffe Bible Translators

mark_anderson_us
Hi Jim

A bit puzzled by this. I can see how it works for TOC, but how would it get the Chapter/@ref element for the main content?

Regards

Mark
jim_albright
I don't understand your problem.

Jim Albright
Wycliffe Bible Translators