Coherence and resonance effects in high-order harmonic generation.