|
Subject: RE: [xsl] Listing things in columns From: Jarno.Elovirta@xxxxxxxxx Date: Fri, 4 Apr 2003 08:24:05 +0300 |
Hi,
> Each Crate may have from 1 to more than 100 Oranges. When I list them
> alphabetically, in paragraph form, the code looks like this:
>
> <xsl:for-each
> select="//Object[@id=$CrateID]/Relationships/Relationship[Name
> ='Has_Orange']
> /ValueList/Value/Reference">
> <xsl:sort select="." data-type="text" order="ascending"/>
> <xsl:variable name="OrangeName" select="."/>
> <xsl:variable name="OrangeID" select="./@Id"/>
> <a href="{$OrangeID}"><xsl:value-of select="$OrangeName"/></a>
> <xsl:if test="position() != last()">, </xsl:if>
> </xsl:for-each>
>
> But this is messy. Instead, I would like to list them in
> three columns side
> by side.
>
> I tried the following:
> <table>
> <tr>
> <xsl:for-each
> select="//Object[@id=$CrateID]/Relationships/Relationship[Name
> ='Has_Orange']
> /ValueList/Value/Reference">
> <xsl:variable name="OrangeName" select="."/>
> <xsl:variable name="OrangeID" select="./@Id"/>
> <td>
> <a href="{$OrangeID}"><xsl:value-of select="$OrangeName"/></a>
> </td>
> <xsl:if test="position() mod 3 = 0"> [something here to
> end a row and
> start a new row]</xsl:if>
> </xsl:for-each>
> </tr>
> </table>
>
> But I couldn't make anything work inside the if test, because
> it doesn't
> like to see </tr><tr>.
Yours is a grouping problem--see <http://jenitennison.com/xslt/grouping>. If you want to sort the References, you have to use exslt:node-set() or two passes.
Cheers,
Jarno - Assemblage 23: Breath Of Ghosts (143 BPM)
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
| Current Thread |
|---|
|
| <- Previous | Index | Next -> |
|---|---|---|
| [xsl] Listing things in columns, walter . crockett | Thread | RE: [xsl] Listing things in column, Lars Huttar |
| [xsl] interactive: calling CGIs usi, S Woodside | Date | RE: [xsl] interactive: calling CGIs, Jarno . Elovirta |
| Month |