This is the second time recently I came across this requirement so I guess others need it too. This post describes how to set a destintation node to null based upon a condition.
My situation was the source node contained a DateTime which was either valid or set to a zero length string. As some of you will know setting a date to a zero length string will actually set the date to 0001-01-01. That is the date when the world began, allegedly. My destination node is a date field too so I want to ignore the invalid date. But here's the thing - I need to set the target node to null because I need the node present in the output.
The solution is to use a logical operator (= or <>) and a value mapping functoid. In my case I am using a Script functoid to convert the source node value from DateTime to Date. So the Script output is a date string. By the way if you are wondering why I just don't test for this in the Script and set the return parameter to null, its becasue this doesn't work!
Update 24/04/2012: I also ran into a problem where the source node was a Record, that did not contain data but held other elements. I found that for the child elements the trick I used above worked well but, the parent element always appeared in the output as
< ParentNode />
I struggled for a long while to get rid of the offending < ParentNode /> but in the end found that simply using the Logical Existence (?) functoid on the ParentNode was enough. The result was the ParentNode was completely absent from the output except when any of the child elements contained data.