仅限引导空间

joh*_*kar 5 xslt xslt-2.0

给定元素:

 <comments>  comments
go here
</comments>
Run Code Online (Sandbox Code Playgroud)

如何删除多个前导空格字符.我不能使用规范化空间,因为我需要保留换行符等.XSLT 2.0好的.

Jim*_*son 3

使用该replace()功能:

replace($input,'^ +','')
Run Code Online (Sandbox Code Playgroud)

它只处理前导空格字符直到第一个非空格。如果要删除第一个非空白之前的所有前导空白字符(即空格、nl、cr、制表符),请使用:

replace($input,'^\s+','')
Run Code Online (Sandbox Code Playgroud)