Selectable footer text for pdf

Post here questions and problems related to editing and publishing DITA content.
Jeff_Reynolds
Posts: 37
Joined: Tue Apr 13, 2021 9:48 pm

Selectable footer text for pdf

Post by Jeff_Reynolds »

Hi folks,

Might be getting too fancy here, but is there a way I can select footer text at build time when using Publishing templates?

Instead of hardcoding footer text could I inject it by selecting a parameter at build time?

Something like:

Edit a transformation scenario
1. Select a scenario
2. Select a security level, pick from Public, Internal only, Confidential.
3. Let'er rip.
julien_lacour
Posts: 495
Joined: Wed Oct 16, 2019 3:47 pm

Re: Selectable footer text for pdf

Post by julien_lacour »

Hello Jeff,

Sure you can, for example with the following CSS:

Code: Select all

/* args.css.param.security-level */
:root[security-level='public'] {
  string-set: security-level "Public";
}
:root[security-level='internal'] {
  string-set: security-level "Internal only";
}
:root[security-level='confidential'] {
  string-set: security-level "Confidential";
}

@page chapter:first:left, chapter:first:right , chapter:left, chapter:right{
  @bottom-center {
    content: string(security-level);
  }
}
And then by declaring the 'args.css.param.security-level' in the publishing template file:

Code: Select all

<parameters>
  <parameter name="args.css.param.security-level" value="confidential"/>
</parameters>
Regards,
Julien
julien_lacour
Posts: 495
Joined: Wed Oct 16, 2019 3:47 pm

Re: Selectable footer text for pdf

Post by julien_lacour »

Another solution is to use an XPath expression with the value to be displayed in the PDF:

Code: Select all

<bookmeta>
  <data name="security-level" value="Internal only"/>
</bookmeta>
In this case the CSS rule should be the following:

Code: Select all

:root {
  string-set: security-level oxy_xpath("//*[contains(@class, 'bookmap/bookmeta')]//*[contains(@class, 'topic/data')][@name='security-level']/@value");
}

@page chapter:first:left, chapter:first:right , chapter:left, chapter:right{
  @bottom-center {
    content: string(security-level);
  }
}
Regards,
Julien
Jeff_Reynolds
Posts: 37
Joined: Tue Apr 13, 2021 9:48 pm

Re: Selectable footer text for pdf

Post by Jeff_Reynolds »

Thanks Julien!
Post Reply