count the number of words in a xml node using xsl

前端 未结 3 1535
青春惊慌失措
青春惊慌失措 2021-01-12 19:36

Here is the sample xml document.


   count the number of words 

For this example I want

3条回答
  •  慢半拍i
    慢半拍i (楼主)
    2021-01-12 20:04

    Here's an XSLT I was just building based on the answer by Dimitre Novatchev above. It's counting words under root/data/value (this is for .NET resource files [.RESX]), but you can easily adapt it.

    Regarding the node-set function it uses, see the URL mentioned in the XSLT on how to do it with EXSLT enabled processors or others that support this function natively (the use of the msxml namespace is for .NET/MSXML, can easily change that to refer to EXSLT etc.)

    
    
    
    
    
    
      
    
      
        
        
          
            
            
              
            
          
        
    
        
      
    
    
    

自定义标题
段落格式
字体
字号
代码语言
提交回复
热议问题