Replace the startElements in your sample with endElements and it won't work. But adding if(flag) like above additionally to endElement should fix this. Did we get it now? :)
I have it done like the following
characters
flag = trueendElement
if(flag)
append(' ');
flag = false;startElement
if(flag)
append(' ');
flag = false;But after having the closer look on the code I really wonder why my original proposal doing it in endElement depending on the text test should not work. The text only contains child::text() (to say it in XPath) and through the stack the text is completely reordered depending on the order of the endElement tags in the file:
<element>
text1
<element>
text2
</element>
text3
</element>should end in
"text2 text1 text3", shouldn't it? And this should be doable through the text test in endElement.
Joerg
