Subject: RE: [xsl] Grouping with keys or xpath From: TSchutzerWeissmann@xxxxxxxxxxxxxxxx Date: Fri, 4 Oct 2002 11:28:17 +0100 |
Hi Uffe > > Hello, > I have achived to group my xml input(see further down) to the > desired output (see further down) > with with xsl file (see further down) using xpath, but I have > not manage to do the same with keys and the key function. The problem > is that the key is global for the whole document. I only want > to group each articlerow in one variant at time. > Any hint/help would be appreciated > > Best regards > > Uffe You can still use the Muenchian method. If a basic key is <xsl:key name="article_posn" match="nev_article_pos" use="."/> it can be made more specific by making the "use" part a combination of the nev_article_pos value and the id of its parent, for example. <xsl:key name="a_row_article_posn" match="nev_article_pos" use="concat(generate-id(..),'::',.)"/> then you can get the unique nev_article_pos's per article_row like so: <xsl:template match="article_row"> <xsl:variable name="p_id" select="generate-id(.)"/> <xsl:for-each select="nev_article_posn[generate-id(.) = generate-id(key('a_row_article_posn', concat($p_id,'::',.)[1])]"> ... </xsl:for-each> </xsl:template> it's a bit of a headache to look at but it's much quicker than preceding-sibling. Tom XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Grouping with keys or xpa, G. Ken Holman | Thread | RE: [xsl] FO: Show page number only, DPawson |
[xsl] Grouping with keys or xpath, Ulf Carlsson | Date | RE: [xsl] get immediat preceeding n, Andrew Welch |
Month |