Re: [xsl] need further assistance with grouping nodes into groups of 3

Subject: Re: [xsl] need further assistance with grouping nodes into groups of 3
From: "Paul Tyson" <paul@xxxxxxxxxxxxxxxxxxxxxx>
Date: Fri, 28 Sep 2001 09:51:29 -0700
Chuck,

In your 'image' template, do something like this:

<xsl:template match="image">
    <td>
        Path: <a href="{thumbimage/thumbpath}">
            <xsl:value-of select="thumbimage/thumbpath"/></a>
        Description:  <xsl:choose>
                <xsl:when test="title">
                    <xsl:value-of select="substring(title,1,25)"/>
                </xsl:when>
                <xsl:when test="description">
                    <xsl:value-of select="substring(description,1,25)"/>
                </xsl:when>
                <xsl:otherwise>
                    <xsl:value-of select="substring(id,1,25)"/>
                </xsl:otherwise>
            </xsl:choose>
    </td>
</xsl:template>

If <title> or <description> elements may be present but empty, you'll have
to use a different test, like:
        <when test="title != ''">

Good luck,
--Paul

----- Original Message -----
From: "Chuck Thomas" <thoma134@xxxxxxxxxx>
To: <xsl-list@xxxxxxxxxxxxxxxxxxxxxx>
Sent: Friday, September 28, 2001 9:01 AM
Subject: [xsl] need further assistance with grouping nodes into groups of 3


> Hi All,
>
> I am very familiar with basic to intermediate xslt, but this one is a bit
> beyond my current knowledge, so any help is appreciated.
>
> The list archive was partially useful for my request, but I am still
having
> difficulties.
>
> I am working with xml documents structured like:
>
> <images>
> <image>
> <id>mandatory info here</id>
> <title>optional element info may be here</title>
> <description>optional element info may be here</description>
> <thumbimage>
> <thumbpath>http://xxx.xxx.xxx/xxx</thumbpath>
> <thumbformat>MIME info, etc.</thumbformat>
> </thumbimage>
> </image>
>
> <image>
> <id>mandatory info here</id>
> <title>optional element info may be here</title>
> <description>optional element info may be here</description>
> <thumbimage>
> <thumbpath>http://xxx.xxx.xxx/xxx</thumbpath>
> <thumbformat>MIME info, etc.</thumbformat>
> </thumbimage>
> </image>
> </images>
>
> The <images> wrapper contain multiple <image> children.
>
> What I'd like to do is:
>
> a) create an HTML table that breaks the <image> children into groups of
> three, so that the table is only 3 columns wide, and contains as many rows
> as there are groups of three, and
>
> b) display in each table cell:
> 1) the value of the record's thumbpath element
> 2) the first 25 characters of just one of the following elements, in this
> order of precendence (<title>, <description>, or <id>)
>
> The list archive contains some clues on how to break the records into
> groups of 3, but I need further clarification, especially when trying to
> combine it with these other functional requirements.
>
> Any suggestions would be appreciated greatly.
>
> Sincerely,
> Chuck Thomas
>
>
>
> ********************************************************
> INTERVIEWER: "Have you made any contributions to culture?"
> ELVIS:       "Like income taxes, you mean?"
>
>   --From THE QUOTABLE KING
>     (Nashville: Cumberland House, 1997)
>
> "Qui me amat, amet et canem meum" (Love me, love my dog)
>  - A proverb mentioned by St. Bernard in his SERMO PRIMUS
>
> Charles F. Thomas, Certified Archivist
> Digital Projects Coordinator
> Elmer L. Andersen Library, Room 6
> 222 21st Avenue South
> Minneapolis, MN 55455
> 612-625-0028
> thoma134@xxxxxxxxxx
> ********************************************************
>
>  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
>


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


Current Thread