Originally posted by Paul Clapham:
That means, I think, that if you have a <chapter> element that has no children and whose immediate following sibling is also a <chapter> element that has no children, then you want to produce nothing. So you want an expression that describes that situation. Something like this:That probably isn't quite right but hopefully it can be cleaned up to work.
Thanks
Using the above code, if there are text values inside elements,
like
<chapter>2. Chapter 1</chapter>
<chapter>3. Chapter 2</chapter>
<chapter>4. Chapter 3</chapter>
even this is getting converted to
<chapter>4. Chapter 3</chapter>
I want the process to happen if there are only EMPTY elements(with no child elements, no text value and no attribute)