xsl-list
[Top] [All Lists]

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

2006-07-27 03:51:01

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

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

<Prev in Thread] Current Thread [Next in Thread>