How do I prevent duplicates, in XSL?

后端 未结 6 647
长发绾君心
长发绾君心 2021-01-02 12:32

How do I prevent duplicate entries into a list, and then ideally, sort that list? What I\'m doing, is when information at one level is missing, taking the information from

6条回答
  •  没有蜡笔的小新
    2021-01-02 13:21

    There is no need for an XSLT 2.0 solution for this problem.

    Here is an XSLT 1.0 solution, which is more compact than the currently selected XSLT 2.0 solution (35 lines vs. 43 lines):

    
        
        
    
        
    
     
         
           
         
     
    
     
       
    
       
    
        
          
            
    
            
          
        
        
       
     
    
    

    When this transformation is applied on the originally provided XML document, the correct, wanted result is produced:

    
       
          156, 154
          Clinic Building
          1947
       
       
          
             156
             3
          
       
       
          
             156
             Contact prints
          
       
       
          
             154
             Negatives
          
       
    
    

    Update:

    I didn't notice the requirement that the container numbers must appear sorted. Now the solution reflects this.

提交回复
热议问题