Hmmm... You seem to be making this much more complex than it needs to be.
Why not do something like this:
XSL:
<xsl:template match="fotografie">
<xsl:apply-templates/>
</xsl:template>
<xsl:template match="foto">
<div class="thumbnail" onclick="expandImage()">
<div class="imageContainer">
<img src="[EMAIL PROTECTED]" class="img"/>
</div>
<div class="description">
<xsl:apply-templates select="."/>
</div>
</div>
</xsl:template>
CSS:
.thumbnail {
display:inline;
margin:10px;
}
.imageContainer {
padding:3px;
border:1px solid blue;
}
.img {
width:20px;
height:20px;
}
.description {
font-size:80%;
padding:10px;
}
With this you can have you gallery have the columns fit the width of the
(resized) window and they will wrap when necessary. Perhaps I am missing why
you need the complexity?
Best,
-Rob
> -----Original Message-----
> From: Stefano Mazzocchi [mailto:[EMAIL PROTECTED]
> Sent: Thursday, April 03, 2003 2:22 AM
> To: [EMAIL PROTECTED]
>
> Steven Noels wrote:
> > On 3/04/2003 8:52 Jeff Turner wrote:
> >
> >> Pity about losing the declarative processing model.
> >
> >
> > Cannot agree more. Declarative is great SoC.
>
> Get real: what is declarative in
>
> <xsl:choose>
> <xsl:when test="...">
> <xsl:call-template name="blah">
> <xsl:with-param name="whatever>
> <xsl:for-each select="node()">
> <xsl:value-of select="."/>
> </xsl:for-each>
> </xsl:with-param>
> </xsl:call-template>
> </xsl:when>
> <xsl:otherwise>
> ...
> </xsl:otherwise>
> </xsl:choose>
>
> ?
>
> Here is the snipped code I had to write a few days ago in order to
> generate a table of picture thumbnails. Input is something like this
>
> ...
> <fotografie>
> <foto id="1">whatever</foto>
> <foto id="2">blah</foto>
> </fotografie>
> ...
>
>
> The stylesheet looks like this:
>
> ...
>
> <xsl:template match="fotografie">
> <table class="fotografie">
> <xsl:call-template name="rowIterator">
> <xsl:with-param name="row" select="0"/>
> <xsl:with-param name="rows" select="ceiling(count(//foto) div
> $columns)"/>
> </xsl:call-template>
> </table>
> </xsl:template>
>
> <!-- iterates over rows -->
> <xsl:template name="rowIterator">
> <xsl:param name="row"/>
> <xsl:param name="rows"/>
> <xsl:if test="$row < $rows">
> <tr valign="top">
> <xsl:call-template name="columnIterator">
> <xsl:with-param name="row" select="$row"/>
> <xsl:with-param name="column" select="0"/>
> </xsl:call-template>
> </tr>
> <xsl:call-template name="rowIterator">
> <xsl:with-param name="rows" select="$rows"/>
> <xsl:with-param name="row" select="$row + 1"/>
> </xsl:call-template>
> </xsl:if>
> </xsl:template>
>
> <!-- iterates over columns -->
> <xsl:template name="columnIterator">
> <xsl:param name="row"/>
> <xsl:param name="column"/>
> <xsl:variable name="item" select="($row * $columns) + $column + 1"/>
> <xsl:if test="$column < $columns">
> <td align="center" width="{format-number((1 div $columns), '##%')}">
> <xsl:choose>
> <xsl:when test="//foto[$item]">
> <xsl:apply-templates select="//foto[$item]"/>
> </xsl:when>
> <xsl:otherwise>
> <br/>
> </xsl:otherwise>
> </xsl:choose>
> </td>
> <xsl:call-template name="columnIterator">
> <xsl:with-param name="row" select="$row"/>
> <xsl:with-param name="column" select="$column + 1"/>
> </xsl:call-template>
> </xsl:if>
> </xsl:template>