Populating <bookmap> element attributes on cover page.

paulkhillier
Posts: 13
Joined: Wed Jun 27, 2018 12:44 am

Populating <bookmap> element attributes on cover page.

Post by paulkhillier » Wed Jun 27, 2018 4:52 pm

Hello Oxygen Team/Users

We are migrating our structured authoring solution from XMetaL/TopLeaf to Oxygen/DITA Map PDF - based on DITA & CSS (WYSIWYG).

In my custom CSS, I am attempting to display the following on the cover page of our Release Notes:

Issue Date: [today's date] <-- The document issue date
UAT Date: [bookmap attribute "rev"] <-- The release install to UAT date
Production Date: [bookmap attribute "otherprops"] <-- The release production date
[bookmap attribute "type] <-- The security level internal/confidential/public

I have been able to get the issue date formatting using an xpath expression, but I am scratching my head on how to pull in the attribute values (which are dates, manually set on all of of publications dating back years) and security level. Any suggestions on a good way to approach this? :oops: :oops:

With regards,

Paul Hillier

Code: Select all

/* Cover Page */


@media print {

*[class~="front-page/front-page"] {
page: front-page;
}

*[class~="front-page/front-page-title"] {
display:inline;
text-align:left;
margin-top:5in;
font-size:2.5em;
font-family:Segoe UI, helvetica, sans-serif;
color:#00386b;
font-weight:normal;
}

*[class~="bookmap/booktitle"] {
display: inline;
text-align: left;
font-family:Segoe UI, helvetica, sans-serif;
padding-bottom: 1em;
font-weight:normal;
}

*[class~="bookmap/booktitlealt"] {
display: inline;
text-align: left;
padding-bottom: 2.5in;
font-style:normal;
font-weight:normal;
font-family:Segoe UI, helvetica, sans-serif;
color:#6aade4;
}


*[class ~= "bookmap/booktitle"]:after {
display:block;
font-size:0.5em;
content: none;
text-align: right;
padding-bottom: 2.21in;

}

*[class ~= "bookmap/booktitle"]:after(2) {
display:block;
font-size:0.5em;
content: "Issue Date: " oxy_xpath("format-date(current-date(), '[D01] [MNn] [Y0001]')");
text-align: right;
color: gray;

}

*[class ~= "bookmap/booktitle"]:after(3) {
display:block;
font-size:0.5em;
content: "UAT Date: " "[bookmap " attr(rev) "]";
text-align: right;
color: gray;
}

*[class ~= "bookmap/booktitle"]:after(4) {
display:block;
font-size:0.5em;
content: "Production Date: TBD";
text-align: right;
color: gray;
}

*[class ~= "bookmap/booktitle"]:after(5) {
display:block;
font-size:0.75em;
content: "TBD";
text-align: right;
text-transform: uppercase;
padding-top: 0.25em;
color: gray;
}

@page front-page {
@top-left-corner { content:url("sidebar.png") -0.5in}
@top-left { content:none }
@top-center { content:none }
@top-right { content:url("IFDSBLUE2.JPG"); ; padding-top:0.825in}
@top-right-corner { content:none }
@bottom-left-corner { content:none }
@bottom-left { content:none }
@bottom-center { content:none }
@bottom-right { content:none }
@bottom-right-corner{ content:none }
}


}

Dan
Posts: 398
Joined: Mon Feb 03, 2003 10:56 am

Re: Populating <bookmap> element attributes on cover page.

Post by Dan » Thu Jun 28, 2018 10:26 am

The attr() function applies to the element matched by the CSS rule selector. In this case it matches the booktitle. If your attributes are on the root element "bookmap", you will need to use XPath to extract the values from this element. Here is a snippet for this:

Code: Select all



*[class ~= "bookmap/booktitle"]:after(3) {
display:block;
font-size:0.5em;
content: "UAT Date: " "[bookmap " oxy_xpath("(//*[contains(@class, 'bookmap/bookmap')]/@rev)[1]") "]";
text-align: right;
color: gray;
}

*[class ~= "bookmap/booktitle"]:after(4) {
display:block;
font-size:0.5em;
content: "Production Date: " oxy_xpath("(//*[contains(@class, 'bookmap/bookmap')]/@otherprops)[1]");
text-align: right;
color: gray;
}
You may find more information here:
https://www.oxygenxml.com/doc/versions/ ... aid-title5
https://www.oxygenxml.com/doc/versions/ ... ction.html

Let us know if you need more help.

Best regards,
Dan

paulkhillier
Posts: 13
Joined: Wed Jun 27, 2018 12:44 am

Re: Populating <bookmap> element attributes on cover page.

Post by paulkhillier » Thu Jun 28, 2018 5:46 pm

Hi Dan,

Thank you for describing and providing the syntax for this, as well as supporting materials. It worked perfectly with a couple of tweaks (to my own bad code), which I have posted here for future reference to other users.

I am new to CSS for Print / XPath and appreciate the guidance. We're tacking modernizing our outputs for PDF and Webchelp through CSS deliverable-by-deliverable, then plan to reconcile these changes into the DITA/CSS framework within Author, so I anticipate I will be back for more help as we dive in :)

With regards,

Paul Hillier

Code: Select all

*[class ~= "bookmap/booktitle"]:after(2) {
display:block;
font-size:0.5em;
content: "Issue Date: " oxy_xpath("format-date(current-date(), '[D01] [MNn] [Y0001]')");
text-align: right;
color: gray;

}

*[class ~= "bookmap/booktitle"]:after(3) {
display:block;
font-size:0.5em;
content: "UAT Date: " oxy_xpath("(//*[contains(@class, 'bookmap/bookmap')]/@rev)[1]");
text-align: right;
color: gray;
}

*[class ~= "bookmap/booktitle"]:after(4) {
display:block;
font-size:0.5em;
content: "Production Date: " oxy_xpath("(//*[contains(@class, 'bookmap/bookmap')]/@otherprops)[1]");
text-align: right;
color: gray;
}

*[class ~= "bookmap/booktitle"]:after(5) {
display:block;
font-size:0.75em;
content: oxy_xpath("(//*[contains(@class, 'bookmap/bookmap')]/@type)[1]");
text-align: right;
text-transform: uppercase;
padding-top: 0.25em;
color: gray;

Dan
Posts: 398
Joined: Mon Feb 03, 2003 10:56 am

Re: Populating <bookmap> element attributes on cover page.

Post by Dan » Fri Jun 29, 2018 11:31 am

If you plan to reuse styles between the WebHelp output, which is HTML5 based, I recommend to use the DITA to PDF based on HTML5 and CSS.
See the video presentation for details:
https://www.oxygenxml.com/demo/opt.html

Many regards,
Dan

Post Reply