|
Subject: Re: [xsl] xsl key related From: Mark Ivs <markivs2003@xxxxxxxxx> Date: Fri, 19 Nov 2004 17:25:05 -0800 (PST) |
Can someone give me a clue about how I can achieve the
results that I have described below? Thanks again. I
really appreciate your help.
--- Mark Ivs <markivs2003@xxxxxxxxx> wrote:
> Hello,
> I would like to get a list of all unique
> country_groups which has a year=2004 and num=2 and
> display them in multiple table columns. So, if my
> result has 10 items, then for a 2 column layout, my
> table will be 2 column and 5 rows. For 3 column
> layout, my table will be 3 column and 4 rows(last
> column will have 2 rows filled). The number of
> columns
> is declared in a variable. With Jarno's help, I was
> able to get the unique country_groups, but I am not
> sure how to display them in multiple columns. The
> xsl
> currently displays all the items in one column.
>
> If the xsl:key contains only the unique
> contry_groups
> it will be earlier to accomplish what I want. But I
> am
> not if I that's possible.
>
> Can someone help please ? Thank you very much in
> advance.
>
> Mark
>
> -----------------------------------
> XML - stripped down version of the original
> -----------------------------------
> <?xml version="1.0"?>
> <myroot>
>
> <country year="2004" num="1">
> <country_group>WWW</course_group>
> <num>001</num>
> </country>
>
> <country year="2004" num="1">
> <country_group>ZZZ</course_group>
> <num>001</num>
> </country>
>
> <country year="2004" num="2">
> <country_group>AAA</course_group>
> <num>221</num>
> </country>
>
> <country year="2004" num="2">
> <country_group>BBB</course_group>
> <num>002</num>
> </country>
>
> <country year="2004" num="2">
> <country_group>CCC</course_group>
> <num>022</num>
> </country>
>
>
> <country year="2004" num="2">
> <country_group>AAA</course_group>
> <num>011</num>
> </country>
>
> </myroot>
>
>
> -----------------------
> XSL
> -----------------------
> <xsl:key name="groups" match="country"
> use="concat(country_group, @year, @num)"/>
> <xsl:variable name="numberOfColumns" select="2"/>
>
> <xsl:template match="myroot">
> <xsl:apply-templates select="country">
> <xsl:sort select="country_group" />
> </xsl:apply-templates>
> </xsl:template>
>
> <xsl:template match="country">
> <xsl:if test="generate-id() =
> generate-id(key('groups', concat(country_group,
> '2004', '2')))">
> <tr><td><xsl:value-of
> select="country_group"/></td></tr>
> </xsl:if>
> </xsl:template>
>
>
>
> __________________________________
> Do you Yahoo!?
> Meet the all-new My Yahoo! - Try it today!
> http://my.yahoo.com
>
>
__________________________________
Do you Yahoo!?
The all-new My Yahoo! - Get yours free!
http://my.yahoo.com
| Current Thread |
|---|
|
| <- Previous | Index | Next -> |
|---|---|---|
| [xsl] xsl key related, Mark Ivs | Thread | RE: [xsl] xsl key related, Thomas Vanparys |
| Re: Re: Re: [xsl] XSLT Generated Te, Derek Basch | Date | [xsl] doc paths, Bruce D'Arcus |
| Month |