Subject: Re: [xsl] Nesting a flat XML structure From: "Wendell Piez wapiez@xxxxxxxxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> Date: Mon, 29 Oct 2018 20:16:48 -0000 |
Hi, Yes, what Graydon says (multiple passes). Here's a simple pass that wraps lists recursively based on a function that determines a list level for an element in a flat sequence: https://gitlab.coko.foundation/XSweet/XSweet/blob/master/applications/list-promote/mark-lists.xsl It can be followed by a pass to make lists for the wrappers (in this case HTML): https://gitlab.coko.foundation/XSweet/XSweet/blob/master/applications/list-promote/itemize-lists.xsl Because the wrapper is abstracted, either/both the XSLTs can be modified separately. Using XSLT 3.0 they can be chained together (poor man's pipeline) -- or of course you can Do It With Modes: https://gitlab.coko.foundation/XSweet/XSweet/blob/master/applications/list-promote/PROMOTE-lists.xsl However (as I think Graydon also implies), frequently the requirement is so far away from the generic, that it is easier to code it to the case. Cheers, Wendell On Mon, Oct 29, 2018 at 3:02 PM Graydon graydon@xxxxxxxxx <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> wrote: > > On Mon, Oct 29, 2018 at 06:52:59PM -0000, Martin Honnen martin.honnen@xxxxxx scripsit: > [snipped examples] > > though so keeps the "ul" lists separated from the sibling "p" elements, have > > so far not understood why a list belongs into a preceding paragraph. > > I have so far found that taking a word processor format flat sequence of > elements and properly nesting the lists takes interpreting the source > for level, labelling the list with that level (generally via disposable > attribute), and then performing a distinct nesting pass where the final > list item of a list "eats" the immediate follow-sibling lists if the > list has a lower level-label than this list. Especially when you have > complex list items (tables, multiple paragraphs, notes...) it's > generally just easier to approach the problem as a sequence of passes > over the content. > > -- Graydon > -- Wendell Piez | http://www.wendellpiez.com XML | XSLT | electronic publishing Eat Your Vegetables _____oo_________o_o___ooooo____ooooooo_^
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Nesting a flat XML struct, Graydon graydon@xxxx | Thread | Re: [xsl] Nesting a flat XML struct, Graydon graydon@xxxx |
Inline lists (was: Re: [xsl] Nestin, Peter Flynn peter@xx | Date | Re: [xsl] Nesting a flat XML struct, ian.proudfoot@xxxxxx |
Month |