Search for elements that don't have a specific child?

Having trouble installing Oxygen? Got a bug to report? Post it all here.
dagoss
Posts: 24
Joined: Fri Apr 05, 2013 11:01 pm

Search for elements that don't have a specific child?

Post by dagoss »

I have a long docbook document, and for accessibility purposes we're required to have alt text for every single image. This is something that can be easy to miss, and there are probably several throughout the books (literally) hundred of images that does not have an alt tag.

What I'm try to find are any places like this:

Code: Select all


<inlinemediaobject>
<imageobject>
<imagedata fileref="image.png"/>
</imageobject>
</inlinemediaobject>
The above should actually read:

Code: Select all


<inlinemediaobject>
<alt>Image alt text goes here</alt>
<imageobject>
<imagedata fileref="image.png"/>
</imageobject>
</inlinemediaobject>
Does Oxygen have way to search for such instances where I neglected to insert an <alt> tag so I can correct them?
Radu
Posts: 9449
Joined: Fri Jul 09, 2004 5:18 pm

Re: Search for elements that don't have a specific child?

Post by Radu »

Hi,

Maybe using our XPath toolbar or our XPath Build view you could run an XPath like:

Code: Select all

//imageobject[not(preceding-sibling::alt)]
Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
dagoss
Posts: 24
Joined: Fri Apr 05, 2013 11:01 pm

Re: Search for elements that don't have a specific child?

Post by dagoss »

Holy smokes--I didn't realize that's what that toolbar did! I just find everything I needed in 5 seconds. Thanks a bunch!
Post Reply