[xsl] Whitespace question

Subject: [xsl] Whitespace question
From: "Ragulf Pickaxe" <jawxml@xxxxxxxxxxx>
Date: Tue, 18 Sep 2001 06:24:35 +0000
Hello all,

I followed the discussion of yesterday about whitespace since I have the same problem myself.

I am too much a newbie for the answers to make meaning to me, so if I could get someone to explain it in details, I would be very happy.

Using MSXML 3.0, I have following structure:

<code1>bla bla</code1> <code1>more bla bla</code1>

the <code1> tag is for internal structure and should not be printed out for the enduser to see, s/he should just see:
bla bla more bla bla


what is seen is:
bla blamore bla bla

xsl-stylesheet for this part:
<xsl:template match="code1">
	<xsl:apply-templates/>
</xsl:template>

I have tried (a hack) using:
<xsl:template match="code1">
	<xsl:apply-templates/>
	<xsl:if test="following-sibling::*[(name()='code1')][1]">
		<xsl:value-of select = "' '"/>
	</xsl:if>
</xsl:template>

But that one always sets a space, even if there is text between two <code1> tags.

Dimitre Novachev wrote something about specifying xml:space="preserve" on an element - how do you do that? and would that serve the job in this case? If not, is there another way to solve the problem (and how)?

Any help would be very appreciated.

Ragulf Pickaxe

_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp


XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list



Current Thread