Page 1 of 1

Can't Get @type from ditamap topicmeta in CSS

Posted: Sat Mar 02, 2019 2:48 am
by amyers3
Hi,

I'm trying to add content from ditamap topicmeta.

[Codebox=]<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE map PUBLIC "-//OASIS//DTD DITA Map//EN" "map.dtd">
<map title="Test" xml:lang="en">
<title>Test</title>
<topicmeta>
<prodinfo>
<prodname></prodname>
<vrmlist>
<vrm version="0000"/>
</vrmlist>
</prodinfo>
<data type="subtitle">Example</data>
<data type="watermark"/>
<data type="keywords"/>
<data type="subject"/>
<data type="partno">1234</data>
</topicmeta>
</map>
[/Codebox]

In my CSS, I have the following, but when I build the pdf using html/css, it does not work. If I remove the xpath, and enter "test", it does work. I used the xpath builder in Oxygen Editor 21, and I used that xpath in the CSS. Can someone tell me if they see a problem in my xpath? Thanks a lot.

[Codebox=]/* Add subtitle */
*[class ~= "front-page/front-page-title"]:after(1){
display:block;
content: oxy_xpath('//*:front-page/map[1]/topicmeta[1]/data[1]/@type='subtitle'');
font-size: 1em;
color:black;
}[/Codebox]

Re: Can't Get @type from ditamap topicmeta in CSS

Posted: Mon Mar 04, 2019 1:59 pm
by Costin
Hello,

You should match the text content of the subtitle, so your xpath should look like:

Code: Select all

content: oxy_xpath('//*[contains(@class, " map/topicmeta")]/*[contains(@type, "subtitle")]/text()');
For more information on getting metadata and using it on the cover page, see this section from the User-Guide.

Regards,
Costin

Re: Can't Get @type from ditamap topicmeta in CSS

Posted: Mon Mar 04, 2019 6:54 pm
by amyers3
Thanks Costin!

Adam