XSLT 1.0: replace new line character with _
问题 I am having this below variable <xsl:variable name="testvar"> d e d </xsl:variable> and I have this function: <xsl:choose> <xsl:when test="not($str-input)"> <func:result select="false()"/> </xsl:when> <xsl:otherwise> <func:result select="translate($str-input,$new-line,'_')"/> </xsl:otherwise> </xsl:choose> </func:function> And when I tested the function I saw my result is like this: _ d _ e _ d_ and I want my result to be only d _ e _ d 回答1: In XSLT 1.0: <xsl:stylesheet version="1.0" xmlns