summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenjamin Franzke <benjaminfranzke@googlemail.com>2016-07-05 09:42:39 +0200
committerBenjamin Franzke <benjaminfranzke@googlemail.com>2016-07-05 09:44:21 +0200
commitb7d235d3690b85a0e1947d73f22d2d3ade8812fb (patch)
treebade9ec78e43c1a785bd4eaa8196a69404889fac
parentec83b34a8f2ab92966ecbfc196245f5965306484 (diff)
downloadmutti-web-b7d235d3690b85a0e1947d73f22d2d3ade8812fb.tar.gz
mutti-web-b7d235d3690b85a0e1947d73f22d2d3ade8812fb.tar.bz2
mutti-web-b7d235d3690b85a0e1947d73f22d2d3ade8812fb.zip
Minize whitespace
..but keep leading and trailing whitespace
-rw-r--r--xsl/common.xsl11
1 files changed, 7 insertions, 4 deletions
diff --git a/xsl/common.xsl b/xsl/common.xsl
index 007d8a2..ed5c0f1 100644
--- a/xsl/common.xsl
+++ b/xsl/common.xsl
@@ -28,10 +28,13 @@
doctype-system="about:legacy-compat"
/>
- <!--
- Removes leading and traling spaces, that we probably need!
- <xsl:template match="text()" mode="html"><xsl:value-of select="normalize-space(.)"/></xsl:template>
- -->
+ <xsl:template match="text()" mode="html">
+ <!-- Add leading whitespace, if needed -->
+ <xsl:if test="not(substring(., 1, 1) = normalize-space(substring(., 1, 1)))"><xsl:text> </xsl:text></xsl:if>
+ <xsl:value-of select="normalize-space(.)"/>
+ <!-- Add trailing whitespace, if needed -->
+ <xsl:if test="not(substring(., string-length(.), 1) = normalize-space(substring(., string-length(.), 1)))"><xsl:text> </xsl:text></xsl:if>
+ </xsl:template>
<xsl:template match="html:*" mode="html">
<xsl:copy>