Ways to store CSS-accessible book metadata besides <bookmeta>?
Posted: Wed Jun 05, 2019 7:34 pm
We store metadata about our book in a <bookmeta> element in the top-level bookmap file, like this:
Then I reference this metadata in our PDF Chemistry CSS via oxy_xpath() to populate the cover page and headers/footers, like this:
and this works exactly as expected.
But in the merged XML file created by PDF Chemistry, the book metadata is propagated (duplicated!) in every single topic in the book. This metadata cascade is described as a requirement in the DITA spec (https://docs.oasis-open.org/dita/v1.2/o ... tamap.html), but it contributes to a significant size increase in the merged XML file:
book_without_meta.xml: 4,794,623 bytes
book_with_meta.xml: 5,285,917 bytes
Half a megabyte of text overhead to store a handful of text strings is too much for my comfort, even for a temporary file.
I tried defining some key values in the top-level bookmap:
but they don't get replicated in the merged XML file for me to access via oxy_xpath().
Is there another way to store and maintain book information that can be accessed from CSS? Or is there a way to disable this book metadata propagation in a transform?
Thanks!
- Chris
Code: Select all
<bookmap>
<title>Our Product User Guide</title>
<bookmeta>
<author>chrispy</author>
<publisherinformation>
<organization>My Company, Inc.</organization>
<printlocation>Mountain View, CA</printlocation>
<published>
<publishtype value="general"/>
<completed>
<year>2019</year>
<month>June</month>
</completed>
</published>
</publisherinformation>
<prodinfo>
<prodname>My Product</prodname>
</prodinfo>
<bookid>
<edition>My Version</edition>
</bookid>
</bookmeta>
Code: Select all
*[class~="front-page/front-page-title"]::after(2) {
content: "Version " oxy_xpath('//div[contains(@class, " bookmap/bookmeta ")]//div[contains(@class, " bookmap/edition ")]/text()') ", "
oxy_xpath('//div[contains(@class, " bookmap/bookmeta ")]//div[contains(@class, " bookmap/completed ")]/div[contains(@class, " bookmap/month ")]/text()') " "
oxy_xpath('//div[contains(@class, " bookmap/bookmeta ")]//div[contains(@class, " bookmap/completed ")]/div[contains(@class, " bookmap/year ")]/text()');
}
@page {
@bottom-left {
content: string(maptitle) "\a" oxy_xpath('//div[contains(@class, " bookmap/bookmeta ")]//div[contains(@class, " bookmap/edition ")]/text()');
}
}
But in the merged XML file created by PDF Chemistry, the book metadata is propagated (duplicated!) in every single topic in the book. This metadata cascade is described as a requirement in the DITA spec (https://docs.oasis-open.org/dita/v1.2/o ... tamap.html), but it contributes to a significant size increase in the merged XML file:
book_without_meta.xml: 4,794,623 bytes
book_with_meta.xml: 5,285,917 bytes
Half a megabyte of text overhead to store a handful of text strings is too much for my comfort, even for a temporary file.
I tried defining some key values in the top-level bookmap:
Code: Select all
<keydef keys="version">
<topicmeta>
<keywords>
<keyword>P-2019.03-SP2</keyword>
</keywords>
</topicmeta>
</keydef>
<keydef keys="date">
<topicmeta>
<keywords>
<keyword>June 2019</keyword>
</keywords>
</topicmeta>
</keydef>
Is there another way to store and maintain book information that can be accessed from CSS? Or is there a way to disable this book metadata propagation in a transform?
Thanks!
- Chris