According to her Wikipedia article, Claudia Felicitas, sole surviving daughter of Anna de Medici, got the job of Empress when Emperor Leopold I lost his first wife, Infanta Margarita, without a surviving male heir. He grieved for Margarita, but duty called so he quickly married Claudia who bore two short-lived daughters before she died. Leopold had to keep looking and found a wife who bore an heir in Eleanor Magdalene of Neuburg.