How do I use a regular expression in XSLT 1.0?

前端 未结 3 1336
一个人的身影
一个人的身影 2020-12-16 13:33

I am using XSLT 1.0. My input information may contain these values


123-00




        
3条回答
  •  一整个雨季
    2020-12-16 13:41

    This solution really works in XSLT 1.0 (and is simpler, because it doesn't and needn't use the double-translate method.):

    
     
     
    
     
    
     
    
     
    
     
      
       
    
        Processing X
       
       
        Processing Y
       
      
     
    
    

    when applied on the provided XML fragment -- made a well-formed XML document:

    
        
        123-00
        
        Abc-01
        
        --
        
        Z2-p01
    
    

    the wanted, correct result is produced:

    Processing Y
    
    
    Processing X
    
    Processing Y
    
    
    Processing X
    

    Do Note: Any attempt to use with a true XSLT 1.0 processor code like this (borrowed from another answer to this question) will fail with error:

    
    

    because in XSLT 1.0 it is forbidden for a match pattern to contain a variable reference.

提交回复
热议问题