[xsl] How to split sets into separate TR sets depending on maximum column count

Subject: [xsl] How to split sets into separate TR sets depending on maximum column count
From: "Dave Bartmess" <dingodave@xxxxxxxxxx>
Date: 07 Jun 2003 13:12:08 -0600
I'm trying to establish a web page showing pictures from directories,
but the number of pictures (using thumbnails) for one single page may
exceed the limits of the web page screen output.

For example, a directory contains 20 pictures, but the web page has a
maximum column count of 5.

But when transforming I keep running up against the fact that <TR> and
</TR> elements can't be split into two <xsl:if> statements, causing me
to only get one <TD> element per <TR></TR>, or ALL the <TD> elements for
the number of pictures in the directory in one <TR></TR> pair.

Can someone tell me how to transform this XML (shown below) to allow the
output to look like this:

<TR>
  <TD>
    ...Some picture...
  </TD>
  <TD>
    ...Some picture...
  </TD>
  <TD>
    ...Some picture...
  </TD>
  <TD>
    ...Some picture...
  </TD>
  <TD>
    ...Some picture...
  </TD>
</TR>
<TR>
   ...etc etc ...
</TR>


XML doc:
    <folder name="2003" path="images">
        <Picture name="dsc01842.jpg">
            <thumbnail name="dsc01842_thumb.jpg" width="80" height="80"
/>
        </Picture>
        <Picture name="dsc01843.jpg">
            <thumbnail name="dsc01843_thumb.jpg" width="80" height="80"
/>
        </Picture>
        <Picture name="ReadyForWar.jpg">
            <thumbnail name="ReadyForWar_thumb.jpg" width="80"
height="80" />
        </Picture>
        <Picture name="dsc01844.jpg">
            <thumbnail name="dsc01844_thumb.jpg" width="80" height="80"
/>
        </Picture>
        <Picture name="dsc01845.jpg">
            <thumbnail name="dsc01845_thumb.jpg" width="80" height="80"
/>
        </Picture>
        <Picture name="ReadyForWar2.jpg">
            <thumbnail name="ReadyForWar2_thumb.jpg" width="80"
height="80" />
        </Picture>
        <Picture name="Farmer_Michael_and_guitar.jpg">
            <thumbnail name="Farmer_Michael_and_guitar_thumb.jpg"
width="80" height="80" />
        </Picture>
    </folder>

-- 
David A. Bartmess
Software Configuration Manager / Sr. Software Developer
eDingo Enterprises
http://edingo.net


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread