[xsl] Loss of whitespace with back to back nested tags

Subject: [xsl] Loss of whitespace with back to back nested tags
From: "Kovey, Chris" <CKovey@xxxxxxxxxxx>
Date: Wed, 12 Nov 2003 11:56:52 -0500
Greetings,

I've got a bunch of nested <term> tags within text of particular elements,
that could be linked to a glossary page.  When I have back to back terms,
such as:
<content>
	test1 <term>test2</term> <term>test3</term> test4
</content>

The output comes as test1 test2test3 test4.  I'm sure its something simple,
but cannot find the correct method.  

As always, tia.

Here's the code:


===== XSL =====

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
xmlns:fo="http://www.w3.org/1999/XSL/Format";>


	<xsl:template name="term" match="term">
		<a href="glossary.cfm?ID={@id}"><xsl:value-of
select="text()"/></a>
	</xsl:template>
	
	<xsl:template match="/">
		<xsl:for-each select="/books/book">
			<h1>
				<xsl:value-of select="title"/>
			</h1>
			<blockquote>
				<xsl:for-each select="chapter">
					<h2>
						<xsl:value-of
select="title"/>
					</h2>
					<blockquote>
						<em>
							<xsl:call-template
name="term"/>
							<xsl:apply-templates
select="summary"/>
						</em>
						<br />
						<p>
							<xsl:call-template
name="term"/>
							<xsl:apply-templates
select="body"/>
						</p>
					</blockquote>
				</xsl:for-each><!-- end chapter -->
			</blockquote>
		</xsl:for-each><!-- end /books/book -->
	</xsl:template>
</xsl:stylesheet>


===== XML =====


<?xml version="1.0" encoding="UTF-8"?>
<books>
	<book>
		<title>Book 1</title>
		<type>Fiction</type>
		<chapter>
			<title>Chapter 1</title>
			<summary>the <term id="23">start</term>!</summary>
			<body>
				blah <term id="4">bleh</term> blah blah blah
<term id="2">blah</term>
			</body>
		</chapter>
		<chapter>
			<title>Chapter 2</title>
			<summary>the <term id="32">fight</term>!</summary>
			<body>
				<term id="66">asdf</term> asdf asdf asdf asdf
			</body>
		</chapter>
		<chapter>
			<title>Chapter 3</title>
			<summary>the death<term id="3">!</term>
			</summary>
			<body>
				<term id="54">foo</term> <term
id="11">foo</term> foo <term id="20">foo</term> <term id="55">foo</term>
			</body>
		</chapter>
	</book>
</books>

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


Current Thread