Subject: Re: [xsl] RE: Nested list, from flat to structure From: Martin Honnen <Martin.Honnen@xxxxxx> Date: Tue, 08 Feb 2011 16:35:00 +0100 |
Additional info on this issue: I use XSL version 1.0 and the total number of levels in the list is unknown.
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:mf="http://example.com/mf" xmlns:xs="http://www.w3.org/2001/XMLSchema" exclude-result-prefixes="xs mf" version="2.0">
<xsl:strip-space elements="*"/> <xsl:output indent="yes"/>
<xsl:template match="root"> <xsl:copy> <xsl:sequence select="mf:group(*, 1)"/> </xsl:copy> </xsl:template>
<xsl:template match="lnum1 | lnum2 | lp1 | lp2"> <p> <xsl:apply-templates/> </p> </xsl:template>
<root> <lnum1>list 1 A</lnum1> <lp1>list 1 A paragraph</lp1> <lnum1>list 1 B</lnum1> <lnum2>list 2 A</lnum2> <lnum2>list 2 B</lnum2> <lp2>list 2 paragraph</lp2> <lnum2>list 2 C</lnum2> <lnum1>list 1 C</lnum1> </root>
<root> <list> <point> <p>list 1 A</p> <p>list 1 A paragraph</p> </point> <point> <p>list 1 B</p> <list> <point> <p>list 2 A</p> </point> <point> <p>list 2 B</p> <p>list 2 paragraph</p> </point> <point> <p>list 2 C</p> </point> </list> </point> <point> <p>list 1 C</p> </point> </list> </root>
Martin Honnen http://msmvps.com/blogs/martin_honnen/
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] RE: Nested list, from flat to, Kjellaug Johansen | Thread | [xsl] The Binary Search Tree Data , Dimitre Novatchev |
[xsl] RE: Nested list, from flat to, Kjellaug Johansen | Date | Re: [xsl] Lineheight conditional ba, Dave Pawson |
Month |