Subject: Re: [xsl] Overlap (was: Grouping Text Nodes) From: James Cummings <cummings.james@xxxxxxxxx> Date: Mon, 8 Aug 2005 16:06:20 +0100 |
On 8/4/05, David Carlisle <davidc@xxxxxxxxx> wrote: > I was reading some reviews of extreme (chaired by the same folks who keep > this list in order:-) yesterday was all about overlapping markup, it > seems.. Yes, I would love to go to extreme one day, it always looks interesting, and I always seem to have friends and colleagues there. But speaking of overlap..... ;-) Does someone have an existing stylesheet which enables someone to easily switch between two (arbitrary?) overlapping hierarchies as the dominant hierarchy? eg: file1.xml : ---------- <div> <p><s>This is a paragraph and, oh look it has a page-break in the middle of <pb n="2"/> a sentence.</s> <s>But the paragraph goes on and on.</s></p> <p><s>And here we have another sentence in <note> yet another boring sentence</note> another paragraph.</s> <s>But luckily this time the page break is nicely between setences.</s><pb n="3"/><s>But it is not between paragraphs.</s></p> </div> ---------- file2.xml : parameters - milestone=pb (The stylesheet knows nothing about the elements and where things may or may not be nested, but is passed the currently milestone-like element which is going to become the dominant hierarchy.) ---------- <div> <page> <p xml:id="p1" eID="p2"/><s xml:id="s1" eID="s2">This is a paragraph and, oh look it has a page-break in the middle of </page> <page> a sentence.<s xml:id="s2" sID="s1"/> <s xml:id="s3" eID="s4"/>But the paragraph goes on and on.<s xml:id="s4" sID="s3"/><p xml:id="p2" sID="p1"/> <p xml:id="p3" eID="p4"/> <s xml:id="s5" eID="s6"/>And here we have another sentence in <note xml:id="n1" eID="n2"/> yet another boring sentence<note xml:id="n2" sID="n1"/> another paragraph.<s xml:id="s6" eID="s5"/> <s xml:id="s7" eID="s8"/>But luckily this time the page break is nicely between setences.<s xml:id="s8" sID="s7"/> </page> <page> <s xml:id="s9" eID="s10">But it is not between paragraphs.<s xml:id="s10" sID="s9"/> <p xml:id="p4" sID="p3"/> </div> ---------- Or even better it more intelligently doesn't milestone things which don't need to be: ---------- <div> <page> <p xml:id="p1" eID="p2"/><s xml:id="s1" eID="s2">This is a paragraph and, oh look it has a page-break in the middle of </page> <page> a sentence.<s xml:id="s2" sID="s1"/> <s>But the paragraph goes on and on.</s><p xml:id="p2" sID="p1"/> <p xml:id="p3" eID="p4"/> <s>And here we have another sentence in <note> yet another boring sentence</note> another paragraph.</s> <s>But luckily this time the page break is nicely between setences.</s> </page> <page> <s>But it is not between paragraphs.</s> <p xml:id="p4" sID="p3"/> </div> ----------- I'm assuming that the way to do this is in multiple passes, first milestone everything underneath the root element, then create the structure of the provided milestone (pb) and either simultaneously or on a third pass de-milestone anything that will still be well-formed. Or am I just bonkers? -James -- James Cummings, Cummings dot James at GMail dot com
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Grouping text nodes, David Carlisle | Thread | Re: [xsl] Overlap (was: Grouping Te, David Carlisle |
Re: [xsl] basic xml help, Joris Gillis | Date | Re: [xsl] Overlap (was: Grouping Te, David Carlisle |
Month |