This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Apply-template printing text from parent before applying template to child


Hello,
I`m new to XSL and I`m having a bit of problems.
I have the following files:

XML:
<letterGen date="2002-01-01">
	<letter langPref="e">
		<surname>Lastname</surname>
		<givenName>Firstname</givenName>
		<address1>101 MyRoad</address1>
		<address2>Apt 8</address2>
		<city>MyCity</city>
		<province>MyProv</province>
		<postalCode>A1A 1A1</postalCode>
		<accountNum>023498287</accountNum>
		<nsf letterAmount="5">
			<currentBalance>-23.11</currentBalance>
			<chequeTo>My company</chequeTo>
			<chequeAmount>60.00</chequeAmount>
		</nsf>
	</letter>
</letterGen>

XSL:
<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 match="letterGen">
		<html>
			<head>
				<title>Test</title>
			</head>
			<body>
				<p>
					<xsl:value-of select="@date"/>
				</p>
				<xsl:apply-templates/>
			</body>
		</html>
	</xsl:template>
	<xsl:template match="letter">
		<p>
			<xsl:value-of
select="givenName"/>&#160;<xsl:value-of select="surname"/>
			<br/>
			<xsl:value-of select="address1"/>
			<br/>
			<xsl:value-of select="address2"/>
			<br/>
			<xsl:value-of select="city"/>,&#160;<xsl:value-of
select="province"/>
			<br/>
			<xsl:value-of select="postalCode"/>
			<br/>
		</p>
		<p>Dear Member:</p>
		<xsl:apply-templates/>
	</xsl:template>
	<xsl:template match="nsf">
		<p>
			We wish to advice you that your chequing account
currently has insufficient funds to cover the cheque / MasterCard debit of
<xsl:value-of select="chequeAmount"/> received today.
		</p>
	</xsl:template>
</xsl:stylesheet>

The problem that I'm having is that in my template for LETTER, when I do the
apply-templates, hoping to get the template for NSF, it prints out the text
contents of LETTER before the template for NSF, giving me the following :

<html xmlns:fo="http://www.w3.org/1999/XSL/Format";>
<head>
<META http-equiv="Content-Type" content="text/html; charset=UTF-16">
<title>Test</title>
</head>
<body>
<p>2002-01-01</p>
<p>Firstname Lastname<br>101 MyRoad<br>Apt 8<br>MyCity, MyProv<br>A1A
1A1<br></p>
<p>Dear Member:</p>LastnameFirstname101 MyRoadApt 8MyCityMyProvA1A
1A1023498287<p>
			We wish to advice you that your chequing account
currently has insufficient funds to cover the cheque / MasterCard debit of
60.00 received today.
		</p>
</body>
</html>

I'm sorry for not being able to explain very well, but I'd appreciate any
help.  Thank you

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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]