Edit online

You can use the content extracted from the document using the oxy_xpath function in your pseudo elements (:before, :after) or in string-set variables.

For example, the following XPath finds the publication author, set in the DITA map:

<map>
  <title>The Art of Bike Repair</title>
  <topicmeta>
    <author>John Doe</author>
  </topicmeta>
...
:root {
    string-set: author oxy_xpath('//*[contains(@class, "front-page/front-page")]/*[contains(@class, "map/topicmeta")]/*[contains(@class, "topic/author")]/text()');
}

To debug an XPath expression:

  1. Read the XPath Expressions Guidelines.
  2. Begin by transforming your document using your customization CSS.
  3. In the output folder, you will find a [MAP_NAME].merged.xml file ( or if you are using the DITA Map PDF - based on HTML5 & CSS transformation, a [MAP_NAME].merged.html file).
  4. Open the merged file in the Oxygen XML Editor/Author.
  5. Activate the XPath Builder view (Window > Show View > XPath/XQuery Builder).
  6. Paste your XPath expression and press the Execute XPath button. Check if it returns the expected results.

The XPath builder has a function that allows it to display the document path of the current element from the editor (Settings drop-down menu > Update on cursor move). Alternatively, you can right-click the element in the merged document and select the Copy XPath action, then paste it in the XPath builder.