views:

354

answers:

2

Hi,

my question is a bit different from the other ones..

i got an xsl-code like this:

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

what i want in my result is:

result_of_select_1    result_of_select_2

what i get is:

result_of_select_1result_of_select_2

how can i prevent this? ( any xsl:output option for example? )

All the other solutions i found were specificly for the same problem but in the XML-Source document and not in the XSLT-document like this one...

btw. a solution like "insert elements instead of the spaces" is not a possible solution for my, because the xslt-code is generated dynamically

thanks in advance

+1  A: 

Use:

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

EDIT:

Refer to this ASCII table for other symbols

Rashmi Pandit
This isn't going to work because the entity will be converted to a space when the xml for the stylesheet is parsed. At which point it will become insignificant whitespace in the same way as the xslt in the original query.
Nic Gibson
I disagree ... I have been using this throughout the application without any problem. <xsl:value-of select="'abc'"/> <xsl:value-of select="'abc'"> will o/p 'abcabc' But, <xsl:value-of select="'abc'"/><xsl:value-of select="'abc'"> will output 'abc abc'
Rashmi Pandit
I agree with Ms.Rashmi Pandit's answer .. +1
infant programmer
+3  A: 

The white space as you have it is insignificant and gets discarded. If that was not the case, every last bit of white space you have in your XSLT code would end up in the result document. You must be explicit about the white space you want in the result.

User either:

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

or:

<xsl:value-of select="..." />
<xsl:text>    </xsl:text>
<xsl:value-of select="..." />
Tomalak
Tomalak, its not a good idea to use space anywhere in the xslt if you want to o/p space. Instead you should use either or <xsl:text> </xsl:text>
Rashmi Pandit
Why would that be better? The escaped (' ') and the literal form (' ') of the space character are absolutely equivalent. The escaped form is just a lot more typing and clutters up the source code unnecessarily.
Tomalak
Its a good practice to use ascii characters than using blank-space ..
infant programmer