Headers/Footers for Backmatter, Not Frontmatter

jmorales
Posts: 40
Joined: Tue Oct 30, 2018 9:47 pm

Headers/Footers for Backmatter, Not Frontmatter

Post by jmorales » Sat Oct 19, 2019 7:19 am

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: 428
Joined: Mon Feb 03, 2003 10:56 am

Re: Headers/Footers for Backmatter, Not Frontmatter

Post by Dan » Mon Oct 21, 2019 2:47 pm

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: 40
Joined: Tue Oct 30, 2018 9:47 pm

Re: Headers/Footers for Backmatter, Not Frontmatter

Post by jmorales » Tue Oct 22, 2019 4:03 am

Thanks, Dan. That looks very promising. I will experiment with that approach.

jmorales
Posts: 40
Joined: Tue Oct 30, 2018 9:47 pm

Re: Headers/Footers for Backmatter, Not Frontmatter

Post by jmorales » Tue Oct 22, 2019 7:46 am

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: 621
Joined: Mon Dec 05, 2011 6:04 pm

Re: Headers/Footers for Backmatter, Not Frontmatter

Post by Costin » Tue Oct 22, 2019 11:52 am

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: 40
Joined: Tue Oct 30, 2018 9:47 pm

Re: Headers/Footers for Backmatter, Not Frontmatter

Post by jmorales » Tue Oct 22, 2019 5:41 pm

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: 40
Joined: Tue Oct 30, 2018 9:47 pm

Re: Headers/Footers for Backmatter, Not Frontmatter

Post by jmorales » Wed Oct 23, 2019 6:23 am

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: 621
Joined: Mon Dec 05, 2011 6:04 pm

Re: Headers/Footers for Backmatter, Not Frontmatter

Post by Costin » Thu Oct 24, 2019 4:25 pm

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: 40
Joined: Tue Oct 30, 2018 9:47 pm

Re: Headers/Footers for Backmatter, Not Frontmatter

Post by jmorales » Tue Nov 05, 2019 7:43 am

Thanks, Costin. Using !important solved the problem.

Post Reply