Rule-based restructuring of nodes

后端 未结 1 1633
滥情空心
滥情空心 2021-01-27 23:59

Supposed I have the following XML file with nodes I would like to rearrange based on rules:

   
  Some text         


        
1条回答
  •  忘了有多久
    2021-01-28 00:15

    If you could have a rules.xml file living (for example) in the same directory as the XSLT stylesheet file, in (for example) the following format:

    rules.xml

    
    
        
    KeyA KeyM KeyZ
    KeyL KeyN KeyP

    you could then apply the following stylesheet to your input:

    XSLT 1.0

    
    
    
    
    
    
    
    
        
        
        
            
            
                
             
        
         
    
    
    
    
    

    to get the following result:

    
    
       
    Some text Some text
    Some text Some text Some text

    Edit:

    To suppress section rules that do not have matching subsections in the input document, try:

    
    
    
    
    
    
    
    
        
            
            
            
                
                    

    0 讨论(0)
提交回复
热议问题