Page 1 of 1

Search for xml tags with line break

Posted: Tue May 03, 2011 6:00 am
by jeofree
This will be a newbie question so bear with me:

How can I use Oxygen to search a collection of DITA xml files for <ul or <ol occurrences only after a closing paragraph tag-- even if on the next line? In other words, finding all instances of this:

Code: Select all

</p> 
<ol
I just want to find places where either unordered or ordered lists have been started outside of the paragraph instead of inside it, and having no luck using regular expressions to find it because of the line break.

Please give as much detail as you can if responding.

Thanks,

Re: Search for xml tags with line break

Posted: Wed May 04, 2011 4:05 pm
by adrian
Hello,

Use the Find Replace in Files dialog with the following settings.
1. Text to find:

Code: Select all

(<ul|<ol)
2. Enable "Regular expression".
3. Restrict to XPath:

Code: Select all

//(ul|ol)[name(preceding-sibling::*[1])='p']
4. Scope: the folder or selection of your DITA files.

What the XPath does is: It looks for all ul and ol elements(//(ul|ol)) which have the first preceding element(preceding-sibling::*[1]) named 'p'(name(...)='p').

Regards,
Adrian

Re: Search for xml tags with line break

Posted: Wed May 04, 2011 7:11 pm
by jeofree
Adrian,

Thanks, that's perfect.