Formatting string (Removing leading zeros)

后端 未结 8 2052
鱼传尺愫
鱼传尺愫 2021-01-11 10:07

I am newbie to xslt. My requirement is to transform xml file into text file as per the business specifications. I am facing an issue with one of the string formatting issue.

8条回答
  •  栀梦
    栀梦 (楼主)
    2021-01-11 11:05

    Here is one way you could do it in XSLT 1.0.

    First, find the first non-zero element, by removing all the zero elements currently in the value

    
    

    Then, you can find the substring-before this first character, and then use substring-after to get the non-zero part after this

    
    

    Or, to combine the two statements into one

    
    

    So, given the following input

    00012095Kb
    

    Then using the following XSLT

    
       
          
       
    
    

    The following will be output

    12095Kb
    

提交回复
热议问题