Can't Get @type from ditamap topicmeta in CSS

Post here questions and problems related to editing and publishing DITA content.
amyers3
Posts: 28
Joined: Sat Feb 16, 2019 8:43 pm

Can't Get @type from ditamap topicmeta in CSS

Post 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]
Adam Myers
Technical Publications Manager
MATRIXX Software
Costin
Posts: 833
Joined: Mon Dec 05, 2011 6:04 pm

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

Post 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
Costin Sandoi
oXygen XML Editor and Author Support
amyers3
Posts: 28
Joined: Sat Feb 16, 2019 8:43 pm

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

Post by amyers3 »

Thanks Costin!

Adam
Adam Myers
Technical Publications Manager
MATRIXX Software
Post Reply