[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Loss of whitespace with back to back nested tags

Subject: Loss of whitespace with back to back nested tags
From: "Kovey, Chris" <CKovey@xxxxxxxxxxx>
Date: Wed, 12 Nov 2003 11:56:52 -0500
chris kovey
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

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.