Headers/Footers for Backmatter, Not Frontmatter

Post here questions and problems related to editing and publishing DITA content.
jmorales
Posts: 93
Joined: Tue Oct 30, 2018 9:47 pm

Headers/Footers for Backmatter, Not Frontmatter

Post by jmorales »

Hi,
The following page explains to use @page matter-page when setting headers and footers for frontmatter and backmatter: https://www.oxygenxml.com/doc/versions/ ... s_css.html. However, is there a way to set headers and footers only for backmatter and not frontmatter? If that isn't possible, is there a way to set headers and footers for a single topic?

Thanks!
Dan
Posts: 501
Joined: Mon Feb 03, 2003 10:56 am

Re: Headers/Footers for Backmatter, Not Frontmatter

Post by Dan »

You might find useful this topic:

https://www.oxygenxml.com/doc/versions/ ... aid-title5

It shows how to style some topic depending on the role it has in the map.
jmorales
Posts: 93
Joined: Tue Oct 30, 2018 9:47 pm

Re: Headers/Footers for Backmatter, Not Frontmatter

Post by jmorales »

Thanks, Dan. That looks very promising. I will experiment with that approach.
jmorales
Posts: 93
Joined: Tue Oct 30, 2018 9:47 pm

Re: Headers/Footers for Backmatter, Not Frontmatter

Post by jmorales »

Hi Dan, I've been trying to set up styles for an amendments topic in the backmatter, but something's not working. In the ditamap, the topic appears as follows:

<backmatter>
<amendments
href="../topics/document_revision_history_imm_registry_cfg_5_9_3_1c89200f966e2c6fc115aefceb396acc.dita"
toc="no"/>
</backmatter>

In the css I've added this:

*[class ~= "topic/topic"][topicrefclass ~= "bookmap/amendments"] {
page: docrevhist-page;
}

@page docrefhist-page {
background-color:silver;
@top-center {
content: "Doc Rev Hist"
}
}

In the merged html file I can see the following:

<article xmlns:nd="http://www.oxygenxml.com/css2fo/named-destinations" class="- topic/topic concept/concept topic concept nested0" aria-labelledby="ariaid-title23" id="unique_23" topicrefclass="- map/topicref bookmap/amendments " nd:nd-id="c_7775247ee5eb61928e706de363d3d5f5" oid="c_7775247ee5eb61928e706de363d3d5f5">

The topic isn't being rendered with the styles I specified. Did I miss something?

Thanks again.
Costin
Posts: 833
Joined: Mon Dec 05, 2011 6:04 pm

Re: Headers/Footers for Backmatter, Not Frontmatter

Post by Costin »

Hello,

At a quick look, I noticed a typo in your CSS. Once you use "docrevhist-page" and once "docrefhist-page" (notice the "f" instead of "v")
*[class ~= "topic/topic"][topicrefclass ~= "bookmap/amendments"] {
page: docrevhist-page;
}

@page docrefhist-page {
background-color:silver;
@top-center {
content: "Doc Rev Hist"
}
}
Could that be the culprit?

Regards,
Costin
Costin Sandoi
oXygen XML Editor and Author Support
jmorales
Posts: 93
Joined: Tue Oct 30, 2018 9:47 pm

Re: Headers/Footers for Backmatter, Not Frontmatter

Post by jmorales »

Thanks Costin, for catching that typo. Unfortunately, even after I correct it, the styles that I specified are not getting applied to the amendments topic. Is there something else that I am missing?

Thanks!
jmorales
Posts: 93
Joined: Tue Oct 30, 2018 9:47 pm

Re: Headers/Footers for Backmatter, Not Frontmatter

Post by jmorales »

An update on my experiments: I changed the css to read as follows:

*[class ~= "topic/topic"][topicrefclass ~= "bookmap/amendments"] {
page: docrev;
color: purple;
}

@page docrev {
color: green;
@bottom-center {
content: "Footer Text from docrev page"
}
}

When I transform to PDF, the text in the topic comes out purple. So it picked up a property from our *[class ~= "topic/topic"][topicrefclass ~= "bookmap/amendments"] declaration. However, it still didn't pick up any formatting from the @page docrev declaration. And it appears that header and footer items like @top-center, @bottom-center, etc. can only be used within a @page declaration. Thus, I get a syntax error if I try something like this:

*[class ~= "topic/topic"][topicrefclass ~= "bookmap/amendments"] {
@bottom-center {
content: "Footer Text from docrev page"
}
}

So basically I'm still stuck. However, I think the above observations at least confirm that the selector *[class ~= "topic/topic"][topicrefclass ~= "bookmap/amendments"] does select the correct page. I just wish I knew how to get the reference to the @page declaration to work.

Thanks again!
Costin
Posts: 833
Joined: Mon Dec 05, 2011 6:04 pm

Re: Headers/Footers for Backmatter, Not Frontmatter

Post by Costin »

Hi jmorales,

As a general rule, if there are rules that have no impact on the output, then most probably it happens because of two possible causes: the selectors you are using are incorrect (they do not match the specific elements you intend to match), or there might be other rules that have more specific selectors (coming either from the same or from other CSS files - like the default CSS files from oXygen).

You should use the technique described in the "Debugging the CSS" section from the DITA-OT CSS Publishing to PDF Plugin User-Guide

If the selector that you are using matches the right element (you can notice that using your internet browser's CSS inspector tool), then this could be a CSS selectors specificity issue, so you should try to:
- either use a more specific selector instead of

Code: Select all

*[class ~= "topic/topic"][topicrefclass ~= "bookmap/amendments"]
- or use the !important marker on the rule's declarations, like

Code: Select all

page: docrev !important;
color: purple !important;
as described in the "Other techniques" part from the above mentioned User-Guide section.

Regards,
Costin
Costin Sandoi
oXygen XML Editor and Author Support
jmorales
Posts: 93
Joined: Tue Oct 30, 2018 9:47 pm

Re: Headers/Footers for Backmatter, Not Frontmatter

Post by jmorales »

Thanks, Costin. Using !important solved the problem.
Post Reply