[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: xsl key related

Subject: RE: xsl key related
From: "Thomas Vanparys" <thomas.vanparys@xxxxxxxxxx>
Date: Sat, 20 Nov 2004 10:33:22 +0100
thomas vanparys
Hi Mark,

Perhaps the following archive is usefull to you:

http://www.biglist.com/lists/xsl-list/archives/200101/msg00202.html

It's a reply Jeni Tennison gave to solve a calendar layout problem.
Might be useful.

Rgds,
Thomas Vanparys

-----Original Message-----
From: Mark Ivs [mailto:markivs2003@xxxxxxxxx]
Sent: 20 November 2004 02:25
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: Re:  xsl key related


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

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.