Marked up data with sectbreaks (was Re: [xsl] XSLT FAQ ideas)

Subject: Marked up data with sectbreaks (was Re: [xsl] XSLT FAQ ideas)
From: Wendell Piez <wapiez@xxxxxxxxxxxxxxxx>
Date: Mon, 17 Feb 2003 18:25:22 -0500
At 11:02 AM 2/17/2003, ERH wrote:
I still don't know whether or not my qwuestion was answered in there somewhere. FYI, it was how do you change

marked up data
<sectbreak/>
marked up data
<sectbreak/>
marked up data

into

<sect>
marked up data
</sect>
<sect>
marked up data
</sect>
<sect>
marked up data
</sect>

I did eventually figure it out. (use the count() function in a recursive template to process all the nodes with a certain number of <sectbreak/> before them)

So far's I know that's a new solution or one not seen in public anyhow. The other known solutions are (1) indexing nodes to sectbreaks (generate-id(preceding::sectbreak[1]) works pretty well), then pulling them when matching sectbreaks ... documented somewhat in the FAQ under "flat" (flat structure to hierarchy). An alternative is a forward stepwise tree walk, in which a template matching a sectbreak has you proceed through the following sibling nodes one by one until you get a new sectbreak.


The problem gets more complicated (much more) if your breaks are not all at the same level.

Cheers,
Wendell


___&&__&_&___&_&__&&&__&_&__&__&&____&&_&___&__&_&&_____&__&__&&_____&_&&_ "Thus I make my own use of the telegraph, without consulting the directors, like the sparrows, which I perceive use it extensively for a perch." -- Thoreau


XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list



Current Thread