xsl-list
[Top] [All Lists]

[xsl] Merging elements

2011-10-27 03:13:51
Morning all

I have a problem that I'm having trouble thinking of an elegant solution for.  
I have xhtml files which contain spans which need to be merged. The files are 
an intermediate stage in a pipeline converting from docx to xhtml (the stage 
before working out the sectional structure and converting formatting to 
headings). The spans may or may not be separated by whitespace. Something like;

<p><span class="strong-emphasis">Fome</span> <span 
class="strong-emphasis">Zero</span>
        <span class="strong">: la stratégie du Brésil pour résoudre les 
problèmes de l'insécurité alimentaire et de la faim </span></p>

And also:

<p><span class="strong">C</span><span class="strong">ontexte</span></p>

I need to merge those spans with identical class attribute values along with 
the whitespace to get something like:

<p><span class="strong-emphasis">Fome Zero</span>
        <span class="strong">: la stratégie du Brésil pour résoudre les 
problèmes de l'insécurité alimentaire et de la faim </span></p>

And:

<p><span class="strong">Contexte</span></p>

I've been looking at the problem for too long and have a horribly complex set 
of grouping statements that applied in a multiple mode stylesheet. I'm 
convinced that there's a simpler way to do this but I think that I can't see 
the wood for the trees. Does anyone have an elegant way to do this?

thanks

nic
--
Corbas Consulting
Digital Publishing Consultancy and Training
http://www.corbas.co.uk, +44 (0)7718 906817/+44 (0)1273 930765  
        


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