XPath to get variable using from linked key using oxy_xpath in PDF css
Posted: Tue May 14, 2019 12:56 pm
Hi,
I'm unsure if this is the right group but I'm using OxygenXML 21.0 and creating PDF using CSS.
I'm trying to use an xpath query in the CSS to extract the revision (stored in a key within a map of keys that's included in the main map).
The xpath expression I use in the CSS extracts the correct value from both the merged XML and the merged html files, in the Oxygenxml XPath/XQuery builder (see attached). But when I create the PDF it comes up blank. It should put the revision value (1.1)![Image]()
I've looked through the online help and think I should give the xpath to the location in the merged XML rather than the more simple one in the DITA file? I'm also unsure if I have correctly used the oxy_xpath() function? Or should I look some place else for the cause?
Any help would be very much appreciated.
CSS and Merged XML below
The xpath in PDF uses the following oxy_xpath in blue :
@page:left {
@top-center{
content: "ROU " oxy_xpath("//*[contains(@class, 'front-page/front-page')][1]/*[contains(@class, 'map/topicmeta')][1]/*[contains(@class, 'topic/category')][1]/*[contains(@class, 'topic/keyword')][1]/text()[1]") " GE";
font-size: 10pt;
font-family: "Arial";
color: red;
}
(the text rendered to the PDF is ROU GE without the extracted revision value (1.1).
The merged XML that is produced is below with the value that should be extracted in blue :
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type='text/css' href='file:/C:/Program Files/Oxygen XML Editor 20.1/frameworks/dita/DITA-OT2.x/plugins/com.oxygenxml.webhelp.responsive/oxygen-webhelp/app/topic-page.css'?>
<?xml-stylesheet type='text/css' href='file:/C:/Program Files/Oxygen XML Editor 20.1/frameworks/dita/css/print/p-dita.css'?>
<?xml-stylesheet type='text/css' href='file:/C:/GitHub/techpubs/buildAutomation/publishingTemplates/css/oxygen-print.css'?>
<?xml-stylesheet type='text/css' href='file:/C:/GitHub/techpubs/buildAutomation/publishingTemplates/css/AAM_style_responsive.css'?>
<?xml-stylesheet type='text/css' href='file:/C:/GitHub/techpubs/buildAutomation/publishingTemplates/css/aam-print-ug.css'?>
<map xmlns:ditaarch="http://dita.oasis-open.org/architecture/2005/"
xmlns:opentopic-index="http://www.idiominc.com/opentopic/index" cascade="merge"
class="- map/map " ditaarch:DITAArchVersion="1.3"
domains="(map mapgroup-d) (topic abbrev-d) (topic delay-d) a(props deliveryTarget) (map ditavalref-d) (map glossref-d) (topic hazard-d) (topic hi-d) (topic indexing-d) (topic markup-d) (topic pr-d) (topic relmgmt-d) (topic sw-d) (topic ui-d) (topic ut-d) (topic markup-d xml-d) "
xtrc="map:1;4:6" xtrf="file:/C:/GitHub/techpubs/AAM/Courier_UG.ditamap">
<oxy:front-page xmlns:oxy="http://www.oxygenxml.com/extensions/author"
class="+ front-page/front-page ">
<topicmeta xmlns:dita-ot="http://dita-ot.sourceforge.net/ns/201007/dita-ot"
xmlns:opentopic="http://www.idiominc.com/opentopic"
xmlns:ot-placeholder="http://suite-sol.com/namespaces/ot-placeholder"
class="- map/topicmeta " xtrc="topicmeta:1;10:13"
xtrf="file:/C:/GitHub/techpubs/AAM/Courier_UG.ditamap">
<category class="- topic/category " xtrc="category:1;11:13"
xtrf="file:/C:/GitHub/techpubs/AAM/Courier_UG.ditamap">Revision <keyword
class="- topic/keyword " keyref="guide_revision" xtrc="keyword:3;11:55"
xtrf="file:/C:/GitHub/techpubs/AAM/Courier_UG.ditamap">1.1</keyword>
</category>
I'm unsure if this is the right group but I'm using OxygenXML 21.0 and creating PDF using CSS.
I'm trying to use an xpath query in the CSS to extract the revision (stored in a key within a map of keys that's included in the main map).
The xpath expression I use in the CSS extracts the correct value from both the merged XML and the merged html files, in the Oxygenxml XPath/XQuery builder (see attached). But when I create the PDF it comes up blank. It should put the revision value (1.1)
I've looked through the online help and think I should give the xpath to the location in the merged XML rather than the more simple one in the DITA file? I'm also unsure if I have correctly used the oxy_xpath() function? Or should I look some place else for the cause?
Any help would be very much appreciated.
CSS and Merged XML below
The xpath in PDF uses the following oxy_xpath in blue :
@page:left {
@top-center{
content: "ROU " oxy_xpath("//*[contains(@class, 'front-page/front-page')][1]/*[contains(@class, 'map/topicmeta')][1]/*[contains(@class, 'topic/category')][1]/*[contains(@class, 'topic/keyword')][1]/text()[1]") " GE";
font-size: 10pt;
font-family: "Arial";
color: red;
}
(the text rendered to the PDF is ROU GE without the extracted revision value (1.1).
The merged XML that is produced is below with the value that should be extracted in blue :
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type='text/css' href='file:/C:/Program Files/Oxygen XML Editor 20.1/frameworks/dita/DITA-OT2.x/plugins/com.oxygenxml.webhelp.responsive/oxygen-webhelp/app/topic-page.css'?>
<?xml-stylesheet type='text/css' href='file:/C:/Program Files/Oxygen XML Editor 20.1/frameworks/dita/css/print/p-dita.css'?>
<?xml-stylesheet type='text/css' href='file:/C:/GitHub/techpubs/buildAutomation/publishingTemplates/css/oxygen-print.css'?>
<?xml-stylesheet type='text/css' href='file:/C:/GitHub/techpubs/buildAutomation/publishingTemplates/css/AAM_style_responsive.css'?>
<?xml-stylesheet type='text/css' href='file:/C:/GitHub/techpubs/buildAutomation/publishingTemplates/css/aam-print-ug.css'?>
<map xmlns:ditaarch="http://dita.oasis-open.org/architecture/2005/"
xmlns:opentopic-index="http://www.idiominc.com/opentopic/index" cascade="merge"
class="- map/map " ditaarch:DITAArchVersion="1.3"
domains="(map mapgroup-d) (topic abbrev-d) (topic delay-d) a(props deliveryTarget) (map ditavalref-d) (map glossref-d) (topic hazard-d) (topic hi-d) (topic indexing-d) (topic markup-d) (topic pr-d) (topic relmgmt-d) (topic sw-d) (topic ui-d) (topic ut-d) (topic markup-d xml-d) "
xtrc="map:1;4:6" xtrf="file:/C:/GitHub/techpubs/AAM/Courier_UG.ditamap">
<oxy:front-page xmlns:oxy="http://www.oxygenxml.com/extensions/author"
class="+ front-page/front-page ">
<topicmeta xmlns:dita-ot="http://dita-ot.sourceforge.net/ns/201007/dita-ot"
xmlns:opentopic="http://www.idiominc.com/opentopic"
xmlns:ot-placeholder="http://suite-sol.com/namespaces/ot-placeholder"
class="- map/topicmeta " xtrc="topicmeta:1;10:13"
xtrf="file:/C:/GitHub/techpubs/AAM/Courier_UG.ditamap">
<category class="- topic/category " xtrc="category:1;11:13"
xtrf="file:/C:/GitHub/techpubs/AAM/Courier_UG.ditamap">Revision <keyword
class="- topic/keyword " keyref="guide_revision" xtrc="keyword:3;11:55"
xtrf="file:/C:/GitHub/techpubs/AAM/Courier_UG.ditamap">1.1</keyword>
</category>