Steve Schwarz wrote:
How do I configure the XMLSerializer to preserve whitespace?

The XML serializer preserves whitespace it gest from earlier stages.

Here's my test case:
Given an XML doc test.xml:
<?xml version="1.0" encoding="UTF-8"?>
<text>Some text with            spaces</text>

I use an XSLT stylesheet text.xsl:
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"; version="1.0">
<xsl:strip-space elements="*"/>
<xsl:preserve-space elements="text"/>


<xsl:template match="text">
    <new-text><xsl:apply-templates/></new-text>
</xsl:template>
</xsl:stylesheet>

With this pipeline the extra whitespace is removed:
<map:match pattern="text.xml">
    <map:generate src="text.xml"/>
    <map:transform src="style/text.xsl"/>
    <map:serialize type="xml"/>
</map:match>

Changing to the TextSerializer preserves the whitespace.
Can  I control this behavior for the XMLSerializer?

I suppose the multiple spaces between "with" and "spaces" appear to be missing. What kind of tool do you use to view the result? Try a plain text editor.

J.Pietschmann


--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to