Appellate courts may only take judicial notice of things over which there can be no reasonable controversy whatsoever. For example, that January 1, 1980 was a Tuesday, or that there are eight U.S. pints in a U.S. gallon, or that on May 19, 2003, George W. Bush was President of the United States. For the appellate courts to take judicial notice of something, it need not be well known, but it must be proven so far beyond question that no reasonable person could argue it.
To allow the court to take judicial notice of anything else would be to grant it a sort of "super-witness" status. Judges aren't perfect, after all (other than the Almighty Judge Greer, of course). If a lawyer's witness offers up "facts" that aren't true, the other lawyer can call his own witnesses to argue the opposite. There's no way, however, for lawyers to challenge a judge's own personal knowledge. If a judge decides to dismiss a personal injury complaint on the basis that 170 degree water isn't hot enough to cause injury, the plaintiff's lawyer would have no opportunity to challenge the judge's beliefs on that matter (or even to be aware of them until after the decision was handed down).
All controversial matters of fact, in all cases, must be examined in trial court. Other courts may only render final judgement on a case in the complete absense of any relevant disputed matters of fact.
Miller and Layton were inticted for possessing a sawed-off shotgun. A judge quashed the indictments without trial, on the basis that it violated the Second-Amendment rights of Miller and Layton. The Supreme Court found that the question of whether a sawed-off shotgun had military utility was (1) relevant, and (2) disputed. Thus, in the presence of relevant disputed facts, the case needed to go to trial court.
The funny thing is that the government, after winning the opportunity to bring the case to trial court, never bothered to do so. Rather odd for the government to offer a plea bargain for time served in a case it had just won the right to prosecute. Of course, had it lost in trial court, it wouldn't have been able to lie about the nature of its "victory" at the USSC.
It was the trial court that was declared to be in error for taking judicial notice. Of course what they took notice of, implicitly that is, was not relevant. The second amemdent, while it protect keeping and bearing "militia" arms, is not limited to protecting just those. Arms is arms. IIRC, the trial court never mentioned militia arms in it's ruling. But you can check the record which can be found here