How to make a whitespace in XSL?

M

Matt

In XSL, if I want to make a whitespace, I put   but not work. How
to make a space??

The following won't create any spaces. It will output mytitlemyauthor

<xsl:value-of select="title"> <xsl:value-of select="author">

But the following will output mytitle++myauthor:
<xsl:value-of select="title">++<xsl:value-of select="author">

any ideas? please advise. thanks!!
 
D

David Carlisle

<xsl:text> </xsl:text>

will make three spaces.

You mentioned nbsp which is the html entity for non breaking space.
that's character 160 so you could use
<xsl:value-of select="title">   <xsl:value-of select="author">
to get that (which would most likely be serialised using the nbsp
entity in html output)

Note however calling nbsp white space is rather misleading, it explictly
is not white space according to both the xML and HTML recommendations.
It is not allowed in places "whitespace" is allowed (such as between
attributes, or to indent elements in element-only content).

David
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,982
Messages
2,570,185
Members
46,738
Latest member
JinaMacvit

Latest Threads

Top