Re: [xsl] Grouping by character runs (and keeping element structure)

Subject: Re: [xsl] Grouping by character runs (and keeping element structure)
From: David Carlisle <davidc@xxxxxxxxx>
Date: Thu, 27 Jul 2006 11:50:46 +0100
> Is there a certain pattern on how to tackle these kind of problems in
> XSLT, or is the language just not the tool of choice for this kind of
> transformation?

last time this came up on this list (a while ago, not sure I could find
it in the archives)  two solutions were proposed (one from Mike and one
from me, so that made a change:-) they were radically different.


I made a pre-pass that flattened all the markup in the paragraph to text
so there was a single text node that could be handled with
analyze-string, then did a final pass that handled each remaining text
node with analyze-string to put the markup back.

Mike did a pre-pass to tokenize the original text node and wrap every
word in an element (as I recall) then use xsl:for-each-group to add your
grouping element (<marker> in your case) then did a final pass taht
unwrapped the tokenized  words back into larger text nodes.

David

Current Thread