To use XPath expressions in CSS, you need to use the oxy_xpath() function.
These XPath expressions are used to extract the content from the HTML merged DITA map
document.
*[class~="front-page/front-page-title"]:before {
text-align: left;
content: oxy_xpath("(//*[contains(@class, 'topic/prodname')]/text())[1]");
display:block;
}@class attribute instead, as these attributes are
propagated to the HTML elements while the element names can be lost. By using the class
selectors, you also cover DITA specializations.For
example: oxy_xpath("(//*[contains(@class,
'topic/prodname')]/text())[1]").
Note that the meta-information might be
copied multiple times in the output, inherited by the <topicref>
elements, so you might get more values than expected.
oxy_xpath() function in string-set
property.oxy_xpath() function in both
pseudo-elements and @page at-rules.Suppose that you need to display the publication author in the bottom-left part of the cover page.
<map>
<title>The Art of Bike Repair</title>
<topicmeta>
<author>John Doe</author>
</topicmeta>
...
</map><div class="- front-page/front-page front-page">
<div class="- map/topicmeta topicmeta">
<div class="- topic/author author">John Doe</div>
</div>
<div class="- front-page/front-page-title front-page-title">
<div class="- topic/title title">The Art of Bike Repair</div>
</div>
</div>//*[contains(@class, "front-page/front-page")]/*[contains(@class,
"map/topicmeta")]/*[contains(@class, "topic/author")]/text()) and click the
Execute XPath button. Check if it returns the expected results.:root {
string-set: author oxy_xpath('//*[contains(@class, "front-page/front-page")]\
/*[contains(@class, "map/topicmeta")]/*[contains(@class, "topic/author")]/text()');
}
@page front-page {
@bottom-left {
content: "Created by " string(author);
}
}