xsl for-each: add code block every n rows?

前端 未结 3 617
执笔经年
执笔经年 2021-01-06 10:27

I am trying to transform a bit of xml which represents an image gallery into an html table. (it must be done with html and not with css). How do I add the row break

3条回答
  •  悲哀的现实
    2021-01-06 11:30

    First, assuming that you are using an output format of XML or HTML, I don't think you can place unmatched tags as your are with the segment. XSL (in these modes) doesn't just produce string output the way you would with your Javascript. (I could be wrong about this though.)

    What you're doing there is closely related to paging; you might look at paging scripts.

    Here's an (untested) suggestion from me:

    
    
      
         
         
    
         
         
           
            
              
            
            
              
            
           
         
      
    
    

    Oh, and IIRC, the interior of the loop can be shortened a little bit too:

    {gallery-image-alt}
    

    Those curly braces will help save your sanity on long scripts.

提交回复
热议问题