Plone.app.theming - prevent whitespace stripping

I've noticed a discrepancy in "styling" between my local machine (Windows 7) and a dev server (CentOS 6.8) on Plone 5.0.5 out-of-the-box. In actuality it appears that the theming translations are removing whitespace such that elements have no spacing between them, and no css padding has been defined. This can be corrected with css but since that involves identifying all templates that rely on whitespace padding, it would be nice to prevent the xml translation from doing this.

Example (Windows):

<div class="formControls">                               
    <input id="form-buttons-save" name="form.buttons.save" class="submit-widget button-field context" value="Save" type="submit">
    <input id="form-buttons-cancel" name="form.buttons.cancel" class="submit-widget button-field standalone" value="Cancel" type="submit">
    <input id="form-buttons-test" name="form.buttons.test" class="submit-widget button-field" value="Save and send test e-mail" type="submit">
</div>

CentOS:

<div class="formControls">
                            
                                
<input id="form-buttons-save" name="form.buttons.save" class="submit-widget button-field context" value="Save" type="submit"><input id="form-buttons-cancel" name="form.buttons.cancel" class="submit-widget button-field standalone" value="Cancel" type="submit"><input id="form-buttons-test" name="form.buttons.test" class="submit-widget button-field" value="Save and send test e-mail" type="submit"></div>

I assume that this is due to differing libxslt libraries between the two operating systems. Is there any setting in plone.app.theming/lxml to prevent it from doing this, or some potential monkey patch I could make? Maybe the barcellonetta theme should be updated to specify css padding.

I've seen this behaviour before (and remember is because we searching for several hours what the difference was between two identical developer installs where the same page rendered differently in the browser).

Turned out that on one of the machines the compiling/instlaling of libxslt/libxml was wrong and an older or wrong version of lxml was borked and this also influenced whitespace stripping in the Diazo served theme.

Maybe you can play around with the xslt directives in your rules.xml file?

Advanced usage of Diazo shows this:
Inline XSL directives
You may supply inline XSL directives in the rules to tweak the final output.
For instance to strip space from the output document use:
<xsl:strip-space elements="*" />

And http://www.w3schools.com/xsl/el_preserve-space.asp says this:

The <xsl:preserve-space> element is used to define the elements for which white space should be preserved.
The <xsl:strip-space> element is used to define the elements for which white space should be removed.
Note: Preserving white space is the default setting, so using the <xsl:preserve-space> element
is only necessary if the <xsl:strip-space> element is used.
Note: The <xsl:preserve-space> element and the <xsl:strip-space> element are top-level elements.

1 Like