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]

RE: Problem with Xalan processing


Look at <xsl:apply-templates select="???"/>  where ??? is the name of the
element that you want to match.
eg

the section reading:

<H3>Policy Summary</H3>
<HR />
<xsl:apply-templates />

should probably be:

<H3>Policy Summary</H3>
<HR />
<xsl:apply-templates select="BENEFITS"/>

and

<xsl:template match="BENEFIT">
<H4>Benefit: - $<xsl:value-of select="INSTALLMENT" /></H4>
<BR />
<xsl:apply-templates />
</xsl:template>

should probably be

<xsl:template match="BENEFIT">
<H4>Benefit: - $<xsl:value-of select="INSTALLMENT" /></H4>
<BR />
<xsl:apply-templates select="RIDER"/>
</xsl:template>

.


Something like that anyway...


-----Original Message-----
From: owner-xsl-list@mulberrytech.com
[mailto:owner-xsl-list@mulberrytech.com]On Behalf Of
pbingley@tacit.co.nz
Sent: Tuesday, 22 February 2000 12:56
To: xsl-list@mulberrytech.com
Subject: Problem with Xalan processing



I have been trying to get the Xalan processor going and processing some XML
from within a JSP and the actual processing seems to be working but the end
result is puzzling me with a few strange additions to the HTML that should
not be there.  I am relatively new to XSLT so maybe my style sheet is
incorrect but if someone could explain what is going wrong here?

The resulting HTML seems to have things added in each time apply-templates
is encountered

here is the XML:
<?xml version="1.0"?>
<POLICY>
     <INSTALLMENT>805.75</INSTALLMENT>
     <PAYMENT_FREQ>2</PAYMENT_FREQ>
          <BENEFIT>
          <INSTALLMENT>805.75</INSTALLMENT>
          <NUMBER>1</NUMBER>
               <RIDER>
                    <INSTALLMENT>385.54</INSTALLMENT>
                    <NUMBER>1</NUMBER>
                    <RATE>7.2040</RATE>
               </RIDER>
               <RIDER>
                    <INSTALLMENT>378.20</INSTALLMENT>
                    <NUMBER>2</NUMBER>
                    <RATE>7.2040</RATE>
               </RIDER>
               <RIDER>
                    <INSTALLMENT>42.01</INSTALLMENT>
                    <NUMBER>3</NUMBER>
                    <RATE>8.0000</RATE>
               </RIDER>
          </BENEFIT>
</POLICY>


and the XSL:

<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version
="1.0">

<xsl:template match="/">
<xsl:apply-templates />
</xsl:template>

<xsl:template match="POLICY">
<HTML>
<HEAD>
<TITLE>the quote</TITLE>
</HEAD>
<BODY>
<H1>Your Policy Installment Premium is $<xsl:value-of select="INSTALLMENT"
/></H1>
<BR />
<H1>To be paid <xsl:value-of select="PAYMENT_FREQ" /> times per year.</H1>
<BR />
<BR /><BR />
<H3>Policy Summary</H3>
<HR />
<xsl:apply-templates />
</BODY>
</HTML>
</xsl:template>

<xsl:template match="BENEFIT">
<H4>Benefit: - $<xsl:value-of select="INSTALLMENT" /></H4>
<BR />
<xsl:apply-templates />
</xsl:template>

<xsl:template match="RIDER">
Rider #<xsl:value-of select="NUMBER" /> .......... $<xsl:value-of select
="INSTALLMENT" />
<BR />
</xsl:template>

</xsl:stylesheet>

and this is the HTML result:


<HTML>
<HEAD>
<TITLE>the quote</TITLE>
</HEAD>
<BODY>

<H1>The Policy Installment Premium is $805.75</H1>
<BR>
<H1>To be paid 2 times per year.</H1>
<BR>
<BR>
<BR>
<H3>Policy Summary</H3>
<HR>
     805.75

     2

          <H4>Benefit: - $805.75</H4>
<BR>
          805.75
          1

Rider #1 .......... $385.54<BR>

Rider #2 .......... $378.20<BR>

Rider #3 .......... $42.01<BR>

</BODY>
</HTML>



Thanks in advance

Phil


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


 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]