Prevent deletion of whitespace between two XSLT elements with xslt processor

my question is a little different from others.

I have xsl code:

<xsl:value-of select="..."/>    <xsl:value-of select="...">

      

what i want in my result:

result_of_select_1    result_of_select_2

      

what i get:

result_of_select_1result_of_select_2

      

how can i prevent this? (any variant xsl: output like?)

All other solutions I found were specifically for the same problem, but in an XML-Source document, not an XSLT document like this ...

by the way. a solution like "inserting elements instead of spaces" is not a possible solution for mine, because the xslt code is dynamically generated

early

+1


a source to share


2 answers


White space, like yours, is insignificant and discarded. If it isn't, every last bit of white space you have in your XSLT code will end up in the final document. You must clearly state the white space you want in the result.

User:

<xsl:value-of select="concat(..., '    ', ...)" />

      



or

<xsl:value-of select="..." />
<xsl:text>    </xsl:text>
<xsl:value-of select="..." />

      

+3


a source


Using:

<xsl:value-of select="..."/><xsl:text>&#32;</xsl:text><xsl:value-of select="...">

      



EDIT:

Refer to this ASCII table for other characters

+1


a source







All Articles