How to show <othermeta> in PDF transformations?

Having trouble installing <oXygen/>? Got a bug to report? Post it all here.
dbutch
Posts: 8
Joined: Wed Aug 14, 2019 9:16 am

How to show <othermeta> in PDF transformations?

Post by dbutch » Thu Aug 15, 2019 7:29 am

Hi,
We record information about our documents in <bookmeta>. I would like to use this data, including <othermeta>, in the PDF both as metadata and (for some tags) in the headers/footers.
I've had some success getting some of the values through to the PDF, however the <othermeta> does not carry through to the PDF in any form.
The <bookmeta> includes:

Code: Select all

<bookmeta class="- map/topicmeta bookmap/bookmeta ">
        <author>D. Duck</author>
        <keywords>
            <keyword>My department</keyword>
        </keywords>
        <othermeta name="Document ID" content="DB03-COUNTDOWN" class="- topic/othermeta "/>
        <othermeta name="Current revision" content="2.1"/>
Our PDF Chemistry CSS contains the following, which is supposed to dump all meta tags as custom meta fields in the PDF:

Code: Select all

meta {
    -oxy-pdf-meta-custom: attr(name) attr(content);
}

This passes some of the meta tags through to the PDF custom metadata(e.g. Author), however the names do not match the <othermeta> tag names. The tag names showing are matching those in the merged.html file Author view but not what is showing in the Text view.

PDF custom properties.png
PDF custom properties.png (6.45 KiB) Viewed 71 times
merged_html.png
merged_html.png (4.89 KiB) Viewed 71 times

Any ideas why the <othermeta> tag names are not mapping through?

I am very keen to use the Document ID in the document footer - what is the correct Chemistry CSS to pull specific <othermeta> tags like the Document ID through into the PDF document?

Thanks!

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

Re: How to show <othermeta> in PDF transformations?

Post by Dan » Fri Aug 16, 2019 4:07 pm

We will try to find a way to pass the meta information from the merged map to the merged HTML, so you can use it further in the CSS customization.

As a workaround, you can use the oxy_xpath function run over the original map file. You can extract any element value or attribute from the original processed DITA map file. For this use the xtrf attribute that is set on the root element of the merged map. This attribute contains the URL of the input map. For example:

Code: Select all

:root{
     -oxy-pdf-meta-custom: "Document ID" oxy_xpath("document(@xtrf)//othermeta[@name='Document ID']/@content");
}
Many regards,
Dan

dbutch
Posts: 8
Joined: Wed Aug 14, 2019 9:16 am

Re: How to show <othermeta> in PDF transformations?

Post by dbutch » Mon Aug 19, 2019 4:17 am

Thanks for looking into this Dan.

Please bear with my relative lack of experience, but with your workaround example, what should the outcome be?
I have tried implementing it as-is, however there has been no effect at present. Please let me know if it should it be used alongside other CSS and if it is possible to use the outcome and present the text in the footer?

Thanks,
Duncan

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

Re: How to show <othermeta> in PDF transformations?

Post by Dan » Tue Aug 20, 2019 2:55 pm

Hello Duncan,

I corrected the quotes in the example above, it should work now...

The XPath is a powerful way to extract content from an XML document. You can use it in CSS to collect metadata, do calculus, etc..
In the example above, the document function parses the original DITA Map (referred by the @xtrf attribute), then searches all the 'othertmeta' elements that have the attribute name set to the 'Document ID' text, and uses the value of the @content attribute.

Many regards,
Dan

dbutch
Posts: 8
Joined: Wed Aug 14, 2019 9:16 am

Re: How to show <othermeta> in PDF transformations?

Post by dbutch » Wed Aug 21, 2019 6:23 am

Hi Dan,

Thanks for the update.
Implementing your CSS, should I be seeing the Document ID othermeta in the document properties? Currently it is not showing in the PDF custom properties or elsewhere.
I also tried to present the text in the footer using the following CSS, to no avail:

Code: Select all

@page :left:right, chapter:first:left:right  {
    @bottom-center {
        content: "Document ID" oxy_xpath("document(@xtrf)//othermeta[@name='Document ID']/@content")
Appreciate your support.

Duncan

Post Reply