My XML is being generated from a web form and some users are inserting line breaks and characters that being converted to line breaks \n
and broken entities, like &
I'm using some variables to convert and remove bad characters, but I don't know how to strip out these types of characters.
Here's the method I'm using to convert or strip out other bad characters. Let me know if you need to see the entire XSL. …
<xsl:variable name="smallcase" select="'abcdefghijklmnopqrstuvwxyz_aaea'" />
<xsl:variable name="uppercase" select="'ABCDEFGHIJKLMNOPQRSTUVWXYZ äãêÂ.,'" />
<xsl:variable name="linebreaks" select="'\n'" />
<xsl:variable name="nolinebreaks" select="' '" />
…
<xsl:value-of select="translate(Surname, $uppercase, $smallcase)"/>
<xsl:value-of select="translate(normalize-space(Office_photos), $linebreaks, $nolinebreaks)"/>
The text in the XML contains content like this:
<Office_photos>bn_1.jpg: Showing a little Red Sox Pride! \nLeft to right:
Tessa Michelle Summers, \nJulie Gross, Alexis Drzewiecki</Office_photos>
I'm trying to get rid of the \n
character inside the data