Hi Sagi,
In your JS code as in mine, there is a flaw: if the subject fields contains JS customisation (if then else) or personalisation field, the result is not given correctly, it doesn't take into account the JS code, not interpreted, so the functions return all the labels included.
Actually, the CDATA taken is common to all messages, the delivery itself.
So it should be added 2nd pass JS interpretation, a bit as in Content Management (publication templates), in order that it would be evaluated for the accurate message for 1 contact.
I am looking for the exact syntax to do it either with your solution or mine (standard xpath object).
If someone else could help, it would be appreciated.
Regards
J-Serge