Page 1 of 1

Headers/Footers for Backmatter, Not Frontmatter

Posted: Sat Oct 19, 2019 7:19 am
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!

Re: Headers/Footers for Backmatter, Not Frontmatter

Posted: Mon Oct 21, 2019 2:47 pm
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.

Re: Headers/Footers for Backmatter, Not Frontmatter

Posted: Tue Oct 22, 2019 4:03 am
by jmorales
Thanks, Dan. That looks very promising. I will experiment with that approach.

Re: Headers/Footers for Backmatter, Not Frontmatter

Posted: Tue Oct 22, 2019 7:46 am
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.

Re: Headers/Footers for Backmatter, Not Frontmatter

Posted: Tue Oct 22, 2019 11:52 am
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

Re: Headers/Footers for Backmatter, Not Frontmatter

Posted: Tue Oct 22, 2019 5:41 pm
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!

Re: Headers/Footers for Backmatter, Not Frontmatter

Posted: Wed Oct 23, 2019 6:23 am
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!

Re: Headers/Footers for Backmatter, Not Frontmatter

Posted: Thu Oct 24, 2019 4:25 pm
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

Re: Headers/Footers for Backmatter, Not Frontmatter

Posted: Tue Nov 05, 2019 7:43 am
by jmorales
Thanks, Costin. Using !important solved the problem.