Doing a double-pass in XSL?

后端 未结 2 970
忘了有多久
忘了有多久 2021-01-14 10:39

Is it possible to store the output of an XSL transformation in some sort of variable and then perform an additional transformation on the variable\'s contents? (All in one X

2条回答
  •  醉酒成梦
    2021-01-14 11:02

    XSLT 2.0 Solution :

    
      
    
    
    
      
    
    

    The trick here, is to use mode="firstPassResult" for the first pass while all the templates for the sedond pass should have mode="secondPass".

    Edit:

    Example :

    
      Init
    
    
    
      
      
    
      
        
      
    
      
          
            
              
            
          
      
    
      
        
      
    
      
        
          
        
      
    
    
    

    Output :

    [xslt] Init
    

    So the first pass creates some elements with the content of root/a and the second one prints the created elements to std out. Hopefully this is enough to get you going.

提交回复
热议问题