Page 1 of 1

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

Posted: Tue Oct 29, 2013 10:32 pm
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?

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

Posted: Wed Oct 30, 2013 12:12 pm
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

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

Posted: Wed Oct 30, 2013 5:40 pm
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!