Combining results from multiple elements

Here should go questions about transforming XML with XSLT and FOP.
eivindan
Posts: 6
Joined: Mon Sep 29, 2008 2:32 pm

Combining results from multiple elements

Post by eivindan »

Hi

I'm working on a solution for converting Office Open XML into tagged text. The XML contains paragraphs with a single style, and "runs" that can contain multiple style elements, such as Bold, Italic, Underline etc. If the run contains only a single style element, I can easily tag the wanted text. But the problem occurs whenever there are two or more style elements inside a run. How can I combine multiple styles into one in the result? I tried to use a variable to save the result and then use concat() to make a new string, but it seems that xslt variables cannot be updated after they are created.

Simplified XML:

Code: Select all

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<w:document xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main">
<w:p>
<w:pPr>
<w:pStyle @w:val="Normal"/>
</w:pPr>
<w:r>
<w:rPr>
<w:cStyle @w:val="Hyperlink">
<w:b/>
</w:rPr>
<w:t>http://www.oxygenxml.com </w:t>
</w:r>
<w:r>
<w:rPr>
<w:b/>
<w:i/>
</w:rPr>
<w:t> - The best XML editor</w:t>
</w:r>
</w:p>
</w:document>

Wanted output:

Code: Select all

<pstyle:Normal><cStyle:HyperlinkBold>http://www.oxygenxml.com <cStyle:><cStyle:BoldItalic> - The best XML editor<cStyle:><pstyle:> 


I'm grateful for any help!

Eivind