XSLT 1.0: replace new line character with _ <p>I am having this below variable</p> <pre><code> &lt;xsl:variable name="testvar"&gt; d e d &lt;/xsl:variable&gt; </code></pre> <p>and I have this function: </p> <pre><code> &lt;xsl:choose&gt; &lt;xsl:when test="not($str-input)"&gt; &lt;func:result select="false()"/&gt; &lt;/xsl:when&gt; &lt;xsl:otherwise&gt; &lt;func:result select="translate($str-input,$new-line,'_')"/&gt; &lt;/xsl:otherwise&gt; &lt;/xsl:choose&gt; &lt;/func:function&gt; </code></pre> <p>And when I tested the function I saw my result is like this: <strong>_ d _ e _ d_</strong> and I want my result to be only</p> <p><strong>d _ e _ d</strong></p>