Incrementing and checking the counter variable in XSLT

后端 未结 6 1025
梦毁少年i
梦毁少年i 2020-11-29 09:56

I am having little difficulty in assigning a counter variable and incrementing it and then checking for a certain value in XSLT. Here is my code:



        
6条回答
  •  既然无缘
    2020-11-29 10:09

    'Variables' in XSL are actually constants - you cannot change their value. This:

     
    

    will just output the value of $counter+1

    To do loops you have to use recursion - e.g.:

    
    
      
        
        
        
          

    altough it is better to try to avoid loops - in most cases the XSL can be written to avoid it, but I don't understand enough of what are you trying to achieve to give you the complete solution.

提交回复
热议问题