XSLT Ignore duplicate elements across multiple files

前端 未结 2 1739
感情败类
感情败类 2020-12-07 04:13

I recently asked a question regarding how to ignore multiple elements, and got some good responses regarding using \'preceding\' and the Muenchian Method. However I was wond

2条回答
  •  我在风中等你
    2020-12-07 05:18

    If I may, although this has been answered with the Muenchian method, for over 12 years I have been promoting the variable-based grouping method for XSLT 1.0 on mail lists (e.g. http://www.sourceware.org/ml/xsl-list/2001-10/msg00933.html) and in the classroom.

    The variable-based grouping method allows you to group across multiple files in one pass. It also is quite straightforward to do subgroups using the variable-based method. Whatever population you can address can be put into a variable and then the grouping method works on that variable.

    I hope the illustrative transcript below helps ... you can see that the stylesheet is quite compact and you do not need two passes and you do not need to use any extension.

    Data:

    t:\ftemp>type multi.xml 
    
    
        
        
    
    
    t:\ftemp>type File1.xml 
    
    A A B C B A C C

    Results:

    t:\ftemp>call xslt multi.xml multi.xsl 
    
    
    Type Count
    A 6
    B 4
    C 6

    Stylesheet:

    t:\ftemp>type multi.xsl 
      
      
    
      
        
    
          
            
              
    Type Count

提交回复
热议问题