Background
Maintain readable XSL source code while generating HTML without excessive breaks that introduce spaces between sentences and their punctuation interruption. From Rethinking XSLT :
White space in XSLT stylesheets is especially problematic because it serves two purposes: (1) to format the XSLT stylesheet itself; and (2) to indicate where the space should go in the output of the XML data processed by XSLT.
Problem
The XSL template contains the following code:
<xsl:if test="@min-time < @max-time">
for
<xsl:value-of select="@min-time" />
to
<xsl:value-of select="@max-time" />
minutes
</xsl:if>
<xsl:if test="@setting">
on <xsl:value-of select="@setting" /> heat
</xsl:if>
.
This, for example, generates the following output (with simple letters, as shown):
for
2
to
3
minutes
.
All major browsers produce:
for 2 to 3 minutes .
Almost flawless, with the exception of a space between the word minutesand punctuation. Desired Result:
for 2 to 3 minutes.
, , XSL, XSL.
, :
<xsl:value-of select="normalize-space($step)" />.
, <span> . <span> HTML-. :
<xsl:copy-of select="normalize-space($step)" />.
:
<xsl:strip-space elements="*" />
<xsl:output indent="no" ... />
XSLT- ?
!