CSV to XML using xslt - how to have incrementing column name

前端 未结 4 1359
小鲜肉
小鲜肉 2021-01-03 13:42

I have this xslt to convert a csv to xml, works fine, except the tag is the same for all columns. I need it to increment like this


  

        
4条回答
  •  攒了一身酷
    2021-01-03 14:03

    I'm not sure why you're opting for XSLT in this case. It's not the first choice for string handling operations such as this, especially since your source data isn't XML, you're just wrapping it in a node to make it XML. A more obvious approach would be to handle the CSV via something like PHP.

    In any case, to answer the question, if you have access to EXSLT (this is often available with XSLT processors, e.g. PHP's):

    Runnable demo here (see output source).

    
    
    
    
    
        
            
        
    
    
    
    
        
        
            
        
    
    
    
    
        
            
        
    
    

提交回复
热议问题