views:

15

answers:

1

I'm using XSLT templates to generate word documents in XML format.

The problem I'm having is with whitespaces (specifically - tabs).

This is an example of a tab inside a paragraph in xml doc:

<w:p>
<w:r xml:space="preserve">
<w:tab />
<w:t>This is some text after tab</w:t>
</w:r>
</w:p>

I added xml:space="preserve" to save the whitespace generated by tab, and this works in Word2007 (it opens up correctly) but it doesn't in Word2003. For Word2003 I have to put xml:space="preserve" tag inside the root element of w:wordDocument. This is a problem, since we do have a lot of spaces in our generated xml's and the default of ignoring them is a requirement.

I know that Microsofts apps tend to ignore standards misuse and just assume what the user wanted without showing error. I thought that might be the error here since the word2003 and 2007 have different interpretation of the same format. If that's the case - how to correctly set this?

A: 

Word 2007 puts xml:space="preserve" on the w:t element when required.

plutext
No, the word by default puts space=preserve on the root element, and strips away any non-user spaces. And anyway, I'm generating word file, so that means I have to put that element.
veljkoz