Title page dates for OOB publishing template

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

Title page dates for OOB publishing template

Post by Jeff_Reynolds »

Hello!

I am using the Ashes publishing template with great results! Thank you!

I have one question: how do I gracefully inject additional content (like a date, mm/yy) onto the title page? Anytime I try to define content I seems to overwrite the title inherit from the ditamap.

Cheers!
alin
Site Admin
Posts: 268
Joined: Thu Dec 24, 2009 11:21 am

Re: Title page dates for OOB publishing template

Post by alin »

Hello,

You can use an XSLT Extension (https://www.oxygenxml.com/doc/versions/ ... mport.html) in your Publishing Template to generate the additional content.
You can use the following sample as inspiration: https://github.com/oxygenxml/oxygen-pub ... e-in-title
Here is how the output would look like:

Image

Regards,
Alin
Alin Balasa
Software Developer
<oXygen/> XML Editor
http://www.oxygenxml.com
Jeff_Reynolds
Posts: 37
Joined: Tue Apr 13, 2021 9:48 pm

Re: Title page dates for OOB publishing template

Post by Jeff_Reynolds »

Hello!

Thanks for your quick reply!

I did not mention I was generating pdf, and I require changes to place a date on the title page of a pdf title page. Adding a content declaration seems to overwrite the inherited title.

My current page looks like:

Code: Select all

*[class ~= "front-page/front-page-title"] {
    font-size: 36pt;
    line-height: 1.5em;
    font-family: "Montserrat", sans-serif;
    color: #FFFFFF !important;
}

/* Stephen tries to add date to cover page in PDF but did not work.
front-page-title:after(1) {

    content: "May 2021";
    margin-top: 125px;
    vertical-align: baseline;
    text-transform: none;
    display: block;
    color: #00243e;
    font-size: 14pt;
    font-family: "Montserrat";
    font-weight: 500;
    line-height: 1.0;
    text-align: left;

}
 */
Any help you could provide would be greatly appreciated.

Thanks!
Dan
Posts: 501
Joined: Mon Feb 03, 2003 10:56 am

Re: Title page dates for OOB publishing template

Post by Dan »

There are examples in this topic from the documentation, I think they match your use-case:

https://www.oxygenxml.com/doc/versions/ ... aid-title6

I changed a bit your example, I used the class selector, not the element selector, and I used instead of a static content, the current date with a special format:

Code: Select all

*[class ~= "front-page/front-page-title"]:after(1) {

    content: oxy_xpath("format-dateTime(current-dateTime(), '[h1]:[m01] [P] on [MNn] [D].')");
    margin-top: 125px;
    vertical-align: baseline;
    text-transform: none;
    display: block;
    color: #00243e;
    font-size: 14pt;
    font-family: "Montserrat";
    font-weight: 500;
    line-height: 1.0;
    text-align: left;

}
It appears fine, with the date under the title, at the left side of the page. If it does not wor you when you add this rule to the CSS, try using an :after with a higher rank, like :after(5)..

For date formatting see: https://www.w3.org/TR/xslt20/#format-date

Many regards,
Dan
Jeff_Reynolds
Posts: 37
Joined: Tue Apr 13, 2021 9:48 pm

Re: Title page dates for OOB publishing template

Post by Jeff_Reynolds »

Thanks!
Post Reply