How to Debug XPath ExpressionsEdit 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:
- Read the XPath Expressions Guidelines.
- Begin by transforming your document using your customization CSS.
- 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).
- Open the merged file in the Oxygen XML Editor/Author.
- Activate the XPath Builder view ().
- 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 (). Alternatively, you can right-click the element in the merged document and select the Copy XPath action, then paste it in the XPath builder.
Settings drop-down menu
Update on cursor move