XSLT For-Each Wrapping every nth item in a div

前端 未结 3 596
执笔经年
执笔经年 2020-12-20 00:42

I have a series of nodes that are direct child nodes to a parent I want to loop over those nodes but have them wrapped in \'groups\' of 4... I\'m probably not wording this v

3条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-20 01:35

    Faced by the same problem, that is wanting to output

    ...
    ...
    ...

    from a CXML (Collection XML) file (http://gallery.clipflair.net/collection/activities.cxml - the data behind the PivotViewer display at http://gallery.clipflair.net/activity)

    I coined up the following, based on other suggestions here, but using "mode" attribute of "template" and "apply-templates" XSL tags instead which make it cleaner I believe:

    
    
    
    
    
      
      
    
      
    
      
        
          
            
            ClipFlair Activities
            
          
          
            
          
        
      
    
      
    
      
        
    ----------
    ---

    the output from the above when run in Altova XMLSpy tool (note that it uses altova_samplexml processor instruction to find the XML data) is:


    2DaysInParis-OpenActivity-CapRev-FR-EN.clipflair --- http://studio.clipflair.net/?activity=2DaysInParis-OpenActivity-CapRev-FR-EN.clipflair
    
    Abu_Dukhan-CapRev-A1-AR.clipflair --- http://studio.clipflair.net/?activity=Abu_Dukhan-CapRev-A1-AR.clipflair
    
    
    ----------
    
    AFarewellToArms-RevCap-C2-EN.clipflair --- http://studio.clipflair.net/?activity=AFarewellToArms-RevCap-C2-EN.clipflair
    
    agComhaireamhCountingRND.clipflair --- http://studio.clipflair.net/?activity=agComhaireamhCountingRND.clipflair
    
    
    ----------
    
    Al-imtihan-CapRev-B1-AR.clipflair --- http://studio.clipflair.net/?activity=Al-imtihan-CapRev-B1-AR.clipflair
    
    AlBar-Cap-B1-B2-IT.clipflair --- http://studio.clipflair.net/?activity=AlBar-Cap-B1-B2-IT.clipflair
    
    ...
    

提交回复
热议问题