Sorry, I don't understand your problem. Are you having trouble formulating each of the conditions, or combining them into one?
When you say:
For empty I mean: <cd attr="657483">IF IH HERE TEXT OR NOT</cd>
I haven't a clue what you mean.
Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference