[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] RE: Flat to Structured: Handling List Items with Subo
> For example, I could have an ordered list followed by an > unordered list, which would give a group like: > > <p type="li" container="ol" level="1"> > <p type="p" container="li" level="2"> > <p type="li" container="ol" level="1"> > <p type="p" container="li" level="2"> > <p type="li" container="ul" level="1"> > <p type="p" container="li" level="2"> > > Where the result should be: > > <ol> > <li> > <p> > </li> > <li> > <p> > <li> > </ol> > <ul> > <li> > <p> > <li> > </ul> > > I don't see a way to get that result using > group-starting-with on the group members. > I haven't followed the thread closely, but I would tackle the above by first using group-starting with to build the levels <xsl:for-each-group select="*" group-starting-with="*[@level='1']"> applied recursively if necessary for each level, giving <p type="li" container="ol" level="1"> <p type="p" container="li" level="2"> </p> <p type="li" container="ol" level="1"> <p type="p" container="li" level="2"> </p> <p type="li" container="ul" level="1"> <p type="p" container="li" level="2"> </p> and then apply group-adjacent to the level 1's (and perhaps recursively to each level?): <xsl:for-each-group select="*" group-adjacent="@container"> <xsl:element name="{current-grouping-key()}"> <xsl:copy-of select="current-group()"/> </ </ to give your required structure, with a bit of trivial tweaking needed to change <p type="li"> to <li>. Regards, Michael Kay http://www.saxonica.com/ http://twitter.com/michaelhkay
|
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
|