Project

Profile

Help

Trouble Preserving White Space

Added by Anonymous almost 14 years ago

Legacy ID: #8514486 Legacy Poster: Jeff King (jeffking1)

We are running an XSLT stylesheet on an XML file (Docbook) and are transforming it into WordprocessingML. We would like to preserve the white space, including extra spaces and carriage returns. Using the xsl:preserve-space element or the xml:space="preserve" attribute seems to have no effect, the spaces get stripped. Does anyone have any suggestions for dealing with this? Thank you.


Replies (2)

RE: Trouble Preserving White Space - Added by Anonymous almost 14 years ago

Legacy ID: #8514684 Legacy Poster: Michael Kay (mhkay)

xsl:preserve-space is the default, so I wouldn't expect this to make a difference. Need to find out when and why the whitespace is disappearing. You haven't said anything about your environment. If you're on .NET and using the Microsoft XML parser, for example, it strips whitespace by default. In other environments insignificant whitespace is stripped if you are validating against a schema or a DTD. So we need more detail of what you are doing. Confirm whether the whitespace is getting as far as your stylesheet by running a transform that just does xsl:copy-of select="/". If that contains the whitespace, the problem is in your XSLT code. If it doesn't, the problem is in the XML parser setup.

RE: Trouble Preserving White Space - Added by Anonymous almost 14 years ago

Legacy ID: #8518543 Legacy Poster: Jeff King (jeffking1)

Thank you for your quick response. Your suggestions for researching this were very helpful. We found the place in the stylesheet that was removing the spaces and tabs. The carriage returns are being removed by Word itself at the time we are saving it. Thanks again.

    (1-2/2)

    Please register to reply