After the birth of a great lord's daughter, Talia, wise men and astrologers cast the child's horoscope and told the lord that Talia would be later endangered by a splinter of flax. To protect his daughter, the father commands that no flax would ever be brought into his house. Years later, Talia sees an old woman spinning flax on a spindle. She asks the woman if she can stretch the flax herself, but as soon as she begins to spin, a splinter of flax goes under her fingernail, and she drops to the ground, apparently dead. Unable to stand the thought of burying his child, Talia's father, the lord, puts his daughter Talia in one of his country estates.
Some time later, a king, hunting in nearby woods, follows his falcon into the house. He finds Talia, overcome by her beauty, he tries unsuccessfully to wake her, and then has sex with her while she is unconscious. Afterwards, he leaves the girl on the bed and returns to his own city. Still deep in sleep, she gives birth to twins (a boy and a girl). One day, the girl cannot find her mother's breast; and instead she begins to suck on Talia's finger and draws the flax splinter out. Talia awakens immediately. She names them "Sun" and "Moon" and lives with them in the house.
The king returns and finds Talia is awake – and a mother of twins. However, he is already married. He calls out the names of Talia, Sun and Moon in his sleep, and his wife, the queen, hears him. She forces the king's secretary to tell her everything, and then, using a forged message, has Talia's children brought to court. She orders the cook to kill the children and serve them to the king. But the cook hides them, and cooks two lambs instead. The queen taunts the king while he eats.
Then the queen has Talia brought to court. She commands that a huge fire be lit in the courtyard, and that Talia be thrown into the flames. Talia asks to take off her fine garments first. The queen agrees. Talia undresses and utters screams of grief with each piece of clothing. The king hears Talia's screams. His wife tells him that Talia would be burned and that he had unknowingly eaten his own children. The king commands that his wife, his secretary, and the cook be thrown into the fire instead. The cook explains how he had saved Sun and Moon. The king and Talia marry; and the cook is rewarded with the title of royal chamberlain.
The last line of the fairy tale – its moral – is as follows: "Lucky people, so ’tis said, Are blessed by Fortune whilst in bed."