xsl-list
[Top] [All Lists]

Re: Joining sibling elements

2005-08-10 14:00:50
Joris Gillis napisał(a):
Tempore 19:49:30, die 08/10/2005 AD, hinc in xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com scripsit Marcin Miłkowski <milek_pl(_at_)o2(_dot_)pl>:

<b>this</b><b> </b><b>is</b><b> </b><b>bold<text</b>

which should be transformed this:

<b>this is bold text</b>


Here's a stylesheet that will handle this simple scenario:

Thanks, I'll try to extend it to my WordML scenario (your version seems to destroy the format and the most annoying parts are still there).

See a sample of the WordML:

<w:r><w:rPr><w:sz w:val="27"/></w:rPr><w:t>It</w:t></w:r><w:r><w:rPr><w:sz w:val="27"/></w:rPr><w:t> </w:t></w:r><w:r><w:rPr><w:sz w:val="27"/></w:rPr><w:t>is</w:t></w:r><w:r><w:rPr><w:sz w:val="27"/></w:rPr><w:t> </w:t></w:r><w:r><w:rPr><w:sz w:val="27"/></w:rPr><w:t>an</w:t></w:r><w:r><w:rPr><w:sz w:val="27"/></w:rPr><w:t> </w:t></w:r><w:r><w:rPr><w:sz w:val="27"/></w:rPr><w:t>honour</w:t></w:r><w:r><w:rPr><w:sz w:val="27"/></w:rPr><w:t> </w:t></w:r><w:r><w:rPr><w:sz w:val="27"/></w:rPr><w:t>to</w:t></w:r><w:r><w:rPr><w:sz w:val="27"/></w:rPr><w:t> </w:t></w:r><w:r><w:rPr><w:sz w:val="27"/></w:rPr><w:t>be</w:t></w:r><w:r><w:rPr><w:sz w:val="27"/></w:rPr><w:t> </w:t></w:r><w:r><w:rPr><w:sz w:val="27"/></w:rPr><w:t>here</w:t></w:r><w:r><w:rPr><w:sz w:val="27"/></w:rPr><w:t> </w:t></w:r><w:r><w:rPr><w:sz w:val="27"/></w:rPr><w:t>in</w:t></w:r><w:r><w:rPr><w:sz w:val="27"/></w:rPr><w:t> </w:t></w:r><w:r><w:rPr><w:sz w:val="27"/></w:rPr><w:t>the</w:t></w:r><w:r><w:rPr><w:sz w:val="27"/></w:rPr><w:t> </w:t></w:r><w:r><w:rPr><w:sz w:val="27"/></w:rPr><w:t>European</w:t></w:r><w:r><w:rPr><w:sz w:val="27"/></w:rPr><w:t> </w:t></w:r><w:r><w:rPr><w:sz w:val="27"/></w:rPr><w:t>Parliament</w:t></w:r><w:r><w:rPr><w:sz w:val="27"/></w:rPr><w:t> </w:t></w:r><w:r><w:rPr><w:sz w:val="27"/></w:rPr><w:t>today.</w:t></w:r>

It is a single sentence, and the translator is supposed to translate it not in MS Word, but in kind of a specialized XML editor with tags visible. The problem is that the task is to join elements <w:t> so the challenge is not really to join immediate siblings but to join (you might say "compress") same groups of tags to make <w:t> enclose more text. If I understand WordML specs the task would be to join <w:t> under the condition that <w:r> enclosing adjacent <w:t> elements contains same formatting tags.

But from your answer I see that this is possible using XSLT (that was my original question) although because of the recursion involved the processing would probably take some time.

Thanks again,
        Marcin


--~------------------------------------------------------------------
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>