我想删除所有文字后面的换行符,参见附件“ 不需要的换行符,如notepadd所示: alt text http://img13.imageshack.us/img13/9803/clcflinebreak.png 这是我到目前为止: xsl:template match="p"!-- output everything b
不需要的换行符,如notepadd所示:
alt text http://img13.imageshack.us/img13/9803/clcflinebreak.png
这是我到目前为止:
<xsl:template match="p"> <!-- output everything but the See the exhibit text should have the line break removed --> </xsl:template>
有任何想法吗?谢谢!
如果您使用转换生成HTML输出,最简单的方法通常是:<xsl:value-of select="normalize-space($text)"/>
normalize-space strip前导和尾随空格,并用单个空格替换字符串中多个空白字符的运行.
要准确删除尾随的CR / LF对:
<xsl:choose>
<xsl:when test="substring(., string-length(.)-1, 2) = '
'">
<xsl:value-of select="substring(., 1, string-length(.)-2)"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="."/>
</xsl:otherwise>
</xsl:choose>
