Note that there are some explanatory texts on larger screens.

plurals
  1. POConvert OOXML inline formatting to a merged element
    primarykey
    data
    text
    <p>In OOXML, formatting such as bold, italic, etc. can be (and often annoyingly is) split up between multiple elements, like so:</p> <pre><code>&lt;w:p&gt; &lt;w:r&gt; &lt;w:rPr&gt; &lt;w:b/&gt; &lt;/w:rPr&gt; &lt;w:t xml:space="preserve"&gt;This is a &lt;/w:t&gt; &lt;/w:r&gt; &lt;w:r&gt; &lt;w:rPr&gt; &lt;w:b/&gt; &lt;/w:rPr&gt; &lt;w:t xml:space="preserve"&gt;bold &lt;/w:t&gt; &lt;/w:r&gt; &lt;w:r&gt; &lt;w:rPr&gt; &lt;w:b/&gt; &lt;w:i/&gt; &lt;/w:rPr&gt; &lt;w:t&gt;with a bit of italic&lt;/w:t&gt; &lt;/w:r&gt; &lt;w:r&gt; &lt;w:rPr&gt; &lt;w:b/&gt; &lt;/w:rPr&gt; &lt;w:t xml:space="preserve"&gt; &lt;/w:t&gt; &lt;/w:r&gt; &lt;w:r&gt; &lt;w:rPr&gt; &lt;w:b/&gt; &lt;/w:rPr&gt; &lt;w:t&gt;paragr&lt;/w:t&gt; &lt;/w:r&gt; &lt;w:r&gt; &lt;w:rPr&gt; &lt;w:b/&gt; &lt;/w:rPr&gt; &lt;w:t&gt;a&lt;/w:t&gt; &lt;/w:r&gt; &lt;w:r&gt; &lt;w:rPr&gt; &lt;w:b/&gt; &lt;/w:rPr&gt; &lt;w:t&gt;ph&lt;/w:t&gt; &lt;/w:r&gt; &lt;w:r&gt; &lt;w:t xml:space="preserve"&gt; with some non-bold in it too.&lt;/w:t&gt; &lt;/w:r&gt; &lt;/w:p&gt; </code></pre> <p>I need to combine these formatting elements to produce this:</p> <pre><code>&lt;p&gt;&lt;b&gt;This is a mostly bold &lt;i&gt;with a bit of italic&lt;/i&gt; paragraph&lt;/b&gt; with some non-bold in it too.&lt;/p&gt; </code></pre> <p>My initial approach was going to be to write out the start formatting tag when it is first encountered using:</p> <pre><code> &lt;xsl:text disable-output-escaping="yes"&gt;&amp;lt;b&amp;gt;&lt;/xsl:text&gt; </code></pre> <p>And then after I process each <code>&lt;w:r&gt;</code>, check the next one to see if the formatting is still present. If it's not, add the end tag in the same way I add the start tag. I keep thinking there must be a better way to do this, and I'd be grateful for any suggestions. </p> <p>Should also mention that I am tied to XSLT 1.0.</p> <p>The reason for needing this, is that we need to compare an XML file before it is transformed into OOXML, and after it is transformed out of OOXML. The extra formatting tags make it appear as though changes were made when they were not.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload