concatenation two fields in xsl

后端 未结 2 663
后悔当初
后悔当初 2021-01-27 04:31

I have a some xml fields i need to concatenate all the fields in one field


example         


        
2条回答
  •  面向向阳花
    2021-01-27 04:59

    This short and simple (no explicit conditional instructions) XSLT 1.0 transformation:

    
     
    
     
      
        
          
            
              
            
          
          
        
      
     
    
    

    when applied on the provided XML document (corrected for well-formedness):

    
        
            example
        
        
            hello
        
        
            25
        
        
            1
        
    
    

    produces the wanted, correct result:

    
       
          example hello 25 1
       
    
    

    II. XSLT 2.0 solution

    
     
    
     
      
        
          
        
      
     
    
    

    When this transformation is applied on the same XML document (above), the same correct result is produced:

    
       
          example hello 25 1
       
    
    

    Explanation: Using the fact that the default value for the separator attribute of xsl:value-of is a single space.

提交回复
热议问题