Sum of Multiplied Values

前端 未结 2 489
夕颜
夕颜 2021-01-23 02:09

I have a fairly convoluted XML file and I need to do a weighted average of a few values within it using XSL. I am able to complete a sum of the weights OR of the values, but I c

2条回答
  •  南笙
    南笙 (楼主)
    2021-01-23 02:31

    To follow the example in that question you linked to, you would use this in XSLT 2.0/XPath 2.0:

    
    
    

    Doing this summing in XSLT 1.0 is considerably more involved and typically involves either using recursive templates or some manifestation of the node-set() function. Here is an example of the latter:

    
      
    
      
        
        
          
            
              
            
          
        
    
        
      
    
    
    

提交回复
热议问题