[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

Re: [xsl] Joining sibling elements


Subject: Re: [xsl] Joining sibling elements
From: JBryant@xxxxxxxxx
Date: Wed, 10 Aug 2005 16:35:04 -0500

Hi, Marcin,

I have worked a bit with WordML, and I generally don't get such cluttered
output. I suggest that you investigate what you can do to get Word to
produce more reasonable output. Even at its best, though, WordML tends to
be very verbose, so I bet you'll want a way to merge the content of
sibling tags no matter what you can do with Word to improve the source.

Jay Bryant
Bryant Communication Services
(presently consulting at Synergistic Solution Technologies)




Marcin Mi3kowski <milek_pl@xxxxx>
08/10/2005 04:00 PM
Please respond to
xsl-list@xxxxxxxxxxxxxxxxxxxxxx


To
xsl-list@xxxxxxxxxxxxxxxxxxxxxx
cc

Subject
Re: [xsl] Joining sibling elements






Joris Gillis napisa3(a):
> Tempore 19:49:30, die 08/10/2005 AD, hinc in
> xsl-list@xxxxxxxxxxxxxxxxxxxxxx scripsit Marcin Mi3kowski
<milek_pl@xxxxx>:
>
>> <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


Current Thread
Keywords