Forum How do I...?

Are named strings' values maintained between xhtml pages (files)?

isaacc

I'm converting a book from epub to a PDF document. The epub is a folder full of xhtml pages. Prince is handling the conversion swimmingly.

I placed the title of the book in the header of each page, which I grabbed from the <title> element which exists in each and every xhtml page.

I'd also like to place in the header the chapter title. I'm grabbing that from an <h2> element, but which only exists in the first xhtml file of a series that make up the chapter.

I thought named strings maintain their state between pages, until reassigned, but that's not what I'm getting. When Prince processes an xhtml page that doesn't have that (chapter title) <h2> element, the chapter title doesn't appear in the (PDF) page's header.

Here is what I have:

@page {
size:B5;
margin:0;
padding:0;
counter-increment:page;
}

@page:left {
@top-left {
content:counter(page, lower-roman) "\00a0" string(book-title);
width:13.9cm;
margin-top:1.5cm;
margin-bottom:-1cm;
margin-left:1.85cm;
margin-right:1.85cm;
font-style:italic;
font-size:110%;
border-top:thin solid black;
padding:0;
}
}

@page:right {
@top-right {
content:string(chapter-title) "\00a0" counter(page, lower-roman);
width:13.9cm;
margin-top:1.5cm;
margin-bottom:-1cm;
margin-left:1.85cm;
margin-right:1.85cm;
font-style:italic;
font-size:110%;
border-top:thin solid black;
padding:0;
}
}

/* a classed <h2> appearing in only the first xhtml page making up a chapter of the book.

I thought the named string here, chapter-title, will get assigned when that first chapter page xhtml file gets processed, and will maintain its state for subsequent pages, even across xhtml files. It doesn't seem to. */

.chapterTitle {
string-set:chapter-title content();
}

/* Happens to pre-exist in each and every xhtml file. */
title {
string-set: book-title content();
}


Thanks for the help.
mikeday
Right, Prince does not persist named strings across multiple documents. Is it possible to combine the files so that there is one file per chapter, instead of multiple files per chapter?