Changing PDF cover page based on a custom parameter

Post here questions and problems related to editing and publishing DITA content.
raybiss
Posts: 31
Joined: Sat Jan 17, 2015 6:21 pm

Changing PDF cover page based on a custom parameter

Post by raybiss »

Hi,
Using a PDF publishing template, I can add some content to a cover page as explained on this page
https://www.oxygenxml.com/doc/versions/ ... _page.html
with some css like *[class ~= "front-page/front-page-title"]:after(1)

But what I would like to do is add this content only if a custom parameter is set.
I tried a few match pattern inside my merged2html5Extension.xsl
<extension id="com.oxygenxml.pdf.css.xsl.merged2html5" file="xslt/merged2html5Extension.xsl"/>

Example: <xsl:template match="oxy:*[contains(@class, ' front-page/front-page-title ')]">
But I cannot figure out a pattern that works...

Is it possible to change the cover page content via a template or any other way based on a custom parameter?
This custom parameter is working fine within my merged2html5Extension.xsl file on some DITA elements.

Any help is appreciated.

Regards,
Raymond
julien_lacour
Posts: 665
Joined: Wed Oct 16, 2019 3:47 pm

Re: Changing PDF cover page based on a custom parameter

Post by julien_lacour »

Hi Raymond,

Depending on what you want to achieve, one of the solution could be to style using custom parameters, you can add for example the args.css.param.info-cover="yes" parameter into the Configure Transformation Scenario(s) dialog, in your custom DITA Map PDF - based on HTML5 & CSS scenario, then match it in the CSS like this:

Code: Select all

:root[info-cover='yes'] *[class ~= "front-page/front-page-title"]:after(1) {
  ...
}
Like this, if you don't want the information to be displayed, you can simply remove the parameter or set it to "no".

Regards,
Julien
raybiss
Posts: 31
Joined: Sat Jan 17, 2015 6:21 pm

Re: Changing PDF cover page based on a custom parameter

Post by raybiss »

Thank you!
This works like a charm, even from my OT project file.
Best regards,
Raymond
Post Reply