title: left trim white space xslt 1.0
body: <p>I am creating a left trim template and I have this below template:</p>
  
  <pre><code>&lt;xsl:template name="str:left-trim"&gt;
      &lt;xsl:param name="string" select="''"/&gt;
      &lt;xsl:variable name="tmp" select="substring($string, 1, 1)"/&gt;
  
      &lt;xsl:if test="$tmp = ' '"&gt;
          &lt;xsl:variable name="tmp2" select="substring-after($string, $tmp)"/&gt;
          &lt;xsl:choose&gt;
              &lt;xsl:when test="$tmp2 != ''"&gt;
                  &lt;xsl:call-template name="str:left-trim"&gt;
                      &lt;xsl:with-param name="string" select="$tmp2"/&gt;        
                  &lt;/xsl:call-template&gt;
              &lt;/xsl:when&gt;
              &lt;xsl:otherwise&gt;
                  &lt;xsl:value-of select="$tmp2"/&gt;
              &lt;/xsl:otherwise&gt;
          &lt;/xsl:choose&gt;
      &lt;/xsl:if&gt;
      &lt;xsl:if test="$tmp != ' '"&gt;
          &lt;xsl:value-of select="$string"/&gt;
      &lt;/xsl:if&gt;
  &lt;/xsl:template&gt;
  </code></pre>
  
  <p>if I pass an argument like this:</p>
  
  <pre><code>&lt;xsl:variable name="str-test2"&gt;this is a america&lt;/xsl:variable&gt;
  </code></pre>
  
  <p>then my template will work just fine but if I pass an argument like this below then, my template will fail. I think there is something wrong with the break(newline)</p>
  
  <pre><code>    &lt;xsl:variable name="str-test2"&gt;            
          this is a america
      &lt;/xsl:variable&gt;
  </code></pre>
  
  <p>do you have any suggestion?</p>