Subject: Re: [xsl] Grouping Adjacent Elements in XSLT 1.0 and Duplicates From: Jeni Tennison <jeni@xxxxxxxxxxxxxxxx> Date: Wed, 20 Oct 2004 22:07:15 +0100 |
Hi Joe, > It seems to be a recursion problem but i would appreciate any help I > could get. Thanks. The problem is that in the calling template, you're applying templates to all the <ol_li> elements (in no mode). The first list is being generated due to templates being applied to the first <ol_li> element, the second because of templates being applied to the second <ol_li> element and so on. To use the kind of recursion that you're using to construct the lists, you need to just apply templates to the first <ol_li> in each list. So in the calling template, you need something like: <xsl:apply-templates select="para | ol_li[not(preceding-sibling::*[1][self::ol_li])]" /> Alternatively, you could do the whole thing using step-by-step recursion, in which case you need to just apply templates to the first of the <para> or <ol_li> elements: <xsl:apply-templates select="*[1]" /> but build in recursion within the <para> template as well: <xsl:template match="para"> <p><xsl:apply-templates /></p> <xsl:apply-templates select="following-sibling::*[1]" /> </xsl:template> Cheers, Jeni --- Jeni Tennison http://www.jenitennison.com/
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] Grouping Adjacent Elements in, Joe Heidenreich | Thread | Re: [xsl] Grouping Adjacent Element, Anton Triest |
[xsl] HTML sortable columns, John | Date | Re: [xsl] Grouping Adjacent Element, Anton Triest |
Month |