It takes its origin from the fact that a wood-apple eaten by an elephant is execreted apparently quite unchanged though in fact its contents have all been digested and it has become quite empty. It is used to denote the internal worthless state of a thing though externally it looks all right.