We are speaking in a time where parliament had very few power. In 1665, Louis XIV declared: L'Etat c'est moi!
There were more claimants: Rulers of Savoy and Portugal claimed too. If we consider the affaire of the payment of the dowry of M Therese as a trick of old fox Louis XIV, as he did with the war of the Devolution, we ought not consider it in terms of legitime blood primogeniture. In this case, M. Teresa was elder than Margarita. Moreover, Ana de austria was elder than Maria the empress. so descendants from the bavarian line and the austrian habsburgs are after in line. Strictly by blood, Ana was the first. These renounces were exiged by all the states in reason to avoid the hegemony of one over the others. But being alliances changing all time, in few years could have non sense.
The question of blood and dynastic, however, more in such times, was precedent. Loosers obviously protested but Ana Mauritia was the first born, and so Maria Teresa.
Other claims were absurd. Portuguese based them on his line to the Catholic Kings. Sabaudian, to Catalina Mikaela.