Searching for topics that are missing the target

Oxygen general issues.
jmorales
Posts: 93
Joined: Tue Oct 30, 2018 9:47 pm

Searching for topics that are missing the target

Post by jmorales »

Is there a way to search for all the topics that are missing something particular? For example, all topics that don't have a shortdesc element, or that don't include a particular piece of text.
Thanks!
chrispitude
Posts: 907
Joined: Thu May 02, 2019 2:32 pm

Re: Searching for topics that are missing the target

Post by chrispitude »

Hi jmorales,

You could use XPath/XQuery Builder to search your .dita files for a particular XQuery expression.

For example, to find all top-level topics that have a <body> but not a <shortdesc> element, you could search for:

Code: Select all

/*[body][not(shortdesc)]
This identifies topics by elements that have a <body> element.

To find all topics that don't contain a certain phrase (case-insensitive),

Code: Select all

/(topic|concept|task|reference)[not(.//text()[matches(., 'some phrase', 'i')])]
This identifies topics by element name.

If you have other specific queries you'd like to perform, feel free to ask!
jmorales
Posts: 93
Joined: Tue Oct 30, 2018 9:47 pm

Re: Searching for topics that are missing the target

Post by jmorales »

Thanks, chrispitude! That's very helpful. I'd already done some experimenting, but Xpath is not my strong point, so originally I wasn't able to come up with anything workable. However, your examples work very well.
Post Reply