Re: Grouping Adjacent Elements in XSLT 1.0 and Duplica
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::*[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="*" /> 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::*" /> </xsl:template> Cheers, Jeni --- Jeni Tennison http://www.jenitennison.com/
PURCHASE STYLUS STUDIO ONLINE TODAY!
Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!
Download The World's Best XML IDE!
Accelerate XML development with our award-winning XML IDE - Download a free trial today!
Subscribe in XML format