How to use showexpl with an external class?

Showexpl package defines LTXexample environment which allows to define a latex code and shows its result side by side. The problem is that it uses the same documentclass where the latex code is defined and I would like to define which class to use for examples. Do you know if it's possible?

Here you have an examples. It's a beamer presentation with some LTXexamples.

\documentclass{beamer}
\usepackage{showexpl}
\lstset{%
basicstyle=\ttfamily\small,
showspaces=false,
showstringspaces=false,
breaklines=true,
breakautoindent=true,
captionpos=t
}

\begin{document}
\frame[containsverbatim]{
\frametitle{First slide}
\begin{LTXexample}
\begin{itemize}
\item a
\item b
\item c
\end{itemize}
\end{LTXexample}

\begin{LTXexample}
$$a^2+b^2=\sqrt{\frac{c^2}{1}}$$
\end{LTXexample}
}

\frame[containsverbatim]{
\frametitle{Second slide}
\begin{LTXexample}
\documentclass{article}
\begin{document}
\section{Section 1}
Text for section 1
\end{document}
\end{LTXexample}
}
\end{document}


Second slide doesn't show 'section title' beacuse beamer has its own section behaviour, so it seems that \documentclass{article} inside the example doesn't have any effect. The resulting font is sansserif because beamer uses it.

I know I can use several external documents and insert code and results, but with LTXexample or a similar environment would be easier. Do you know a better solution?

-
 +1 for introducing me to showexpl, I spent hours this week more or less doing this by hand... Sigh. – Seamus Nov 26 '10 at 15:35

The LaTeX team had to do something like this for The LaTeX Companion, as a lot of the example packages cannot be mixed. I believe the way it was done was using some special markers in the example .tex files ('start included preamble', 'start included body', etc.), plus a Makefile set up. There is some detail toward the end of the book. – Joseph Wright Nov 26 '10 at 22:27