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]

Re: Apply-template printing text from parent before applying template tochild


Hi Michel,
Its a bit difficult to guess what you actually want..
but if you change the apply-templates in your Letter Template to
<xsl:apply-templates select="nsf"/> (here u are asking the processor to look for the template which matches the element nsf )
Then you would get the following result..

***********************************************

2002-01-01

Firstname Lastname
101 MyRoad
Apt 8
MyCity, MyProv
A1A 1A1

Dear Member:

We wish to advice you that your chequing account currently has insufficient funds to cover the cheque / MasterCard debit of 60.00 received today.

****************************************************
hope this helps ( if the above result is what you are expecting )

Vasu


From: Michel Gallant <michel@cifta.com>
Reply-To: xsl-list@lists.mulberrytech.com
To: "'XSL List (XSL-List@lists.mulberrytech.com)'" <XSL-List@lists.mulberrytech.com>
Subject: [xsl] Apply-template printing text from parent before applying template to child
Date: Tue, 13 Aug 2002 11:18:32 -0300

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"/> <xsl:value-of select="surname"/>
<br/>
<xsl:value-of select="address1"/>
<br/>
<xsl:value-of select="address2"/>
<br/>
<xsl:value-of select="city"/>, <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



_________________________________________________________________
MSN Photos is the easiest way to share and print your photos: http://photos.msn.com/support/worldwide.aspx


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]