Some basics - layer, layer, layer. Start out with long underwear. Depending on the conditions, add sweaters, coats or shells. ALWAYS WEAR A HAT! Fleece pants and coats topped with a wind shell will work for an amazing range of conditions.
Stay away from cotton. Some of the new fabrics (MTS, Capilene, etc) are just as soft as cotton, and do a superior job of wicking moisture away from the skin.
Remember too, that downhill ski gloves are generally too heavy for cross-country. Mittens are great in especially cold weather, and can be worn with light weight liners to really add protection (and don't forget those wonderful little boot warmers).