This is a pretty old post but I thought I'd answer it anyway. The answers to your questions are actually pretty complex, each company has their own way of doing things but generally speaking this is the way it works. If it was a new ballet, the choreographer would probably pick the dancers he or she wanted regardless of their rank in the company. However since you mentioned Sleeping Beauty and Giselle the casting would probably fall to the artistic director. Assuming that there was more than one performance of each ballet the principal roles would probably be shared by each of the principal dancers. One interesting sidenote is that often matinee performances are often used to test new dancers or I should say dancers of less rank to see if they are ready for promotion. As to how far in advance the roles are cast that is often determined by the dancers Union or their individual contracts. Usually casts are announced one month before the performance.