Replace switch with if/else test of text node.

As noted in previous commit messages, in the directive comments, if it
is not a text node, it is counted as a node.