XSLT: How to find the count of unique children of a node?

后端 未结 2 1857
臣服心动
臣服心动 2021-01-26 17:13

My XML looks like this:


    
        
            
            3&         


        
2条回答
  •  迷失自我
    2021-01-26 17:59

    If you want to do this in a generic way then you are really stretching the capability of XSLT 1.0 beyond its design limits. But it can be done.

    Write a named template called deep-equal that takes two elements as its arguments and returns a string containing the character "F" if and only if they are not equal (for your purposes).

    It might look like this:

    
      
      
      
        F
        F
        F
        F
        
          
            
              
              
                
                
              
            
          
        
      
    
    

    Apply this to all relevant pairs of elements:

        
          
           
             
             
           
          
        
    

    Test if the result contains an "F":

    ...
    

提交回复
热议问题