Background
Users can provide text, which is transformed using XSL into a LaTeX document. The XSL template that transforms the XML document (containing user-defined text) currently resembles:
<xsl:template match="user-text">
<xsl:text> \item </xsl:text>
<xsl:apply-templates />
</xsl:template>
This is then transformed into:
\item This is the text the user provided.
Problem
This allows the user to submit maliciously crafted LaTeX:
\item This is the \{latex} the user provided.
Ideas
Some ideas:
\begin{verbatim}and\end{verbatim}cause the text to appear without formatting (i.e., a monospace font).- Write an XSLT function that escapes the special characters.
Question
What is the simplest way to ensure user-defined text does not get interpreted as LaTeX code?
Something like \begin{verbatim} would be perfect if it didn't change the font, and prevent text from wrapping.