The Hasmoneans committed a grave error when, in addition to claiming the "crown" of the Priesthood, they also claimed the crown of royalty in defiance of G‑d's command. They were severely punished by G‑d, and did not only lose the crown after four successive Hasmonean kings died a violent death, but Herod, son of a Gentile slave, became the next king after he had murdered nearly all the Hasmoneans still alive. All this is part of Nachmanides' commentary: (on Genesis 49:10) "The scepter shall not leave Judah". The Talmud (Baba Batra 50) goes so far as to say that anyone claiming to be descended from the Hasmoneans is bound to be a slave, i.e. have Herod's blood in him (Herod had married Miriam, a sister of the Hasmoneans). The failure to re-instate the house of David when there was a chance to do so will not be repaired until the coming of the Mashiach.
At that time, re-instatement of the dynasty of David will be preceded by the Kingdom of Joseph, since the Mashiach ben Joseph will precede the arrival of the Mashiach ben David. After the arrival of the Mashiach ben David the damage caused by the house of Joseph ever since the splitting of the Kingdom of David (Rehoboam) under Jeroboam will be repaired. The Mashiach ben Joseph, when he comes, does not come in order to establish his own dynasty, rather he comes to help re-establish the Davidic dynasty. He will even sacrifice his life in order to accomplish this. His blood will atone for the sins of the Jewish people. This atonement will take the form of the Davidic dynasty being restored to the Jewish people as an everlasting kingdom.
When that stage in history is reached, both of Joseph's dreams will be fulfilled. His two dreams foreshadowed his reign in Egypt as well as his reign in the future, as the Mashiach ben Joseph respectively. In both instances, his reign preceded or will precede that of the reign of David or the Mashiach ben David respectively. Both periods of the reign of the kingdom of Joseph were or will be beneficial for the whole Jewish people because in both instances they were or will be designed to pave the way for the permanent kingdom of David.
When that time comes, the tikun will be completed, and the world will be as good as at the time it was created - when both body and soul were on an equally elevated level.
[Translation and commentary by Eliyahu Munk]

No mans' blood, including that of the mashiach Ben Yosef, has nor can atone for anyone else's sins, let alone the entire Jewish nation. I question whether the Shlah actually wrote this.
To understand the principles presented here, one must understand the intended meaning of the words used.
First the principles of substitute blood atonement is not a human philosophical gymnastic. These are clearly laid out in the Torah. Now, of course, one must understand the intent behind the principles of atonement inasmuch as whether these are actually acceptable on the celestial court of law. This of course implies believing that there is such court and that the Torah attributed to Moshe's hand is not his creation but it's rather the actual Supreme Judge of the celestial court that established this particular set of laws and values and gave it to Moshe for Israel and at large to all the nations to benefit, at least to a certain degree. Based on the principles that Moshe's Torah is aligned with the eternal Torah by which the universe exists, we can safely accept that the principles of substitution for atonement is a universal concept that the Source of the universe has established