Showing metadata and changes in table on the front-page/before the TOC

Having trouble installing <oXygen/>? Got a bug to report? Post it all here.
dyfed
Posts: 1
Joined: Tue Dec 08, 2020 8:08 pm

Showing metadata and changes in table on the front-page/before the TOC

Post by dyfed » Sat Dec 12, 2020 4:20 pm

Hello,

I'm developing right now a customized DITA framework, we are planning to publish a WebHelp and a PDF output generated from the content of a DITA BookMap (consisting of ditamaps and topics). What I would like to do and I don't find yet the best solution for it, is to customize the output in such a way that on the front page besides the title it shows other types of metadata (mainly customized by me in the DTD-s, like product verions, release number, etc.) complying to the style requirements of the company. I have been experimenting with the DITA Map to PDF with HTML5 and CSS transformation scenario and building a custom CSS, though it seems it doesn't allow for a lot of customization. I would like to ask for some advice whether to rather switch to the XSL-FO based transformation scenario, and if so where to begin to put the customization?

Another task would be to include a table of the changes also collected from the metadata section of the Bookmap, which could be done easily if I get right the first section. But I could use some kind of directive in this respect.

At my last job we used such customizations powered by the XSL-FO transformation, and I would like to achieve something like that, but sadly my FO knowledge is a bit lacking to tackle this challange.

julien_lacour
Posts: 164
Joined: Wed Oct 16, 2019 3:47 pm

Re: Showing metadata and changes in table on the front-page/before the TOC

Post by julien_lacour » Mon Dec 14, 2020 12:14 pm

Hello,

You can do this in the DITA Map to PDF with HTML5 and CSS transformation.
The 'oxy_xpath' CSS function allows you to get content from your metadata and use it inside your front-page.
There is more information related to this part in our user-guide.

Regards,
Julien

chrispitude
Posts: 322
Joined: Thu May 02, 2019 2:32 pm

Re: Showing metadata and changes in table on the front-page/before the TOC

Post by chrispitude » Mon Dec 21, 2020 4:31 pm

Hi dyfed,

What Julien provides in his link is exactly how we're doing it too. It is quite simple.

In our bookmaps, we define keys for version, product name, and release date. Because some fields aren't published anywhere else, we use this method:

https://www.oxygenxml.com/doc/versions/ ... id-title10

to force them to become accessible:

Code: Select all

<?xml version="1.0" encoding="utf-8"?>
<?xml-model href="urn:oasis:names:tc:dita:rng:bookmap.rng" schematypens="http://relaxng.org/ns/structure/1.0"?>
<bookmap>  <title>Product ABC User Guide</title>
  <bookmeta>
    <data keyref="Release"/>
    <data keyref="Date"/>
  </bookmeta>
  <frontmatter>
    ...
Then we create a cover page in the CSS as follows:

Code: Select all

/* book title */
@media print {
*[class~="front-page/front-page-title"]::before(1) {  /* set title away from top */
    display: block;
    height: 1.6875in;
    content: '';
}
*[class~="front-page/front-page-title"] {
    display: block;
    text-align: left;
    padding-top: 0in;
    margin-top: 0in;
    margin-left: 0.625in;
    font-size: 24pt;
    font-weight: bold;
}
*[class~="front-page/front-page-title"]::after(1) {
    display: block;
    content: ' ';
    border-bottom: 1.25px solid;
    padding-top: 1pt;
}
*[class~="front-page/front-page-title"]::after(2) {
    content: "Version " oxy_xpath('//div[contains(@class, " bookmap/bookmeta ")]/div[@keyref = "Release"]//text()') ", "
             oxy_xpath('//div[contains(@class, " bookmap/bookmeta ")]/div[@keyref = "Date"]//text()');
    font-size: 16pt;
    font-weight: normal;
    display: block;
}
@page front-page {
    background-image:url("../../../../dita/common_resources/Company_Logo.svg");
    background-position: 50% 85%;
    background-repeat: no-repeat;
    background-size: 2.5in 0.625in;
}
}
Note that we also include the Release and Date keywords in our headers/footers:

Code: Select all

@page {
  @bottom-left {
    content: string(maptitle) "\a" oxy_xpath('//div[contains(@class, " bookmap/bookmeta ")]/div[@keyref = "Release"]//text()');
    font-family: Arial, Helvetica, sansserif;
    font-size: 10pt;
    vertical-align: top;
    padding-top: 0.300in;
  }
}
PDF Chemistry and CSS make all these PDF layout customizations trivially easy.

Post Reply