frenchone
frenchone

Reputation: 1597

xslt: preserve space that exist in xslt without adding xsl:text

my xml

<user>
 <name>John</name>
 <surname>Doe</surname>
</user>

my xslt

<xsl:template match="user">
 <xsl:value-of select="name"/> <xsl:value-of select="surname"/>
</xsl:template>

I want to preserve the space between the two "value-of" = I want the output to be John Doe and not JohnDoe.

Can I do it without adding <xsl:text> </xsl:text> ?

Upvotes: 1

Views: 689

Answers (1)

David Carlisle
David Carlisle

Reputation: 5652

You can use xml:space="preserve" on any containing element (xsl:template here) although then you'd also get the newlines and spaces from the start and end of the template.

Upvotes: 2

Related Questions