[xsl] Problems still with elements print first page only

Subject: [xsl] Problems still with elements print first page only
From: "Tamre Bond" <tamre2@xxxxxxx>
Date: Sun, 22 Jul 2001 14:18:42 -0700
My problem is still that  the correct header information prints on page one
of each statement e.g. acctnum and taxid, but on subsequent pages of the
same statement this information does not print. I know I have a path problem
as I go from
<xsl:for-each select="statement/accountInfo">
 <xsl:for-each select="transactions/transaction">
 </xsl:for-each>   (end of  transactions/transaction)

 back to the original <xsl:for-each select="statement/accountInfo">
Since statement/accountInfo surrounds the entire document, I don't
understand why this is causing me such grief.  I must be looking at this
from the wrong angle.

I need the absolute path for the /statement/period within Pagehead because I
am in a for-each select "statement/accountInfo and need to refer to some
elements outside that.  I can't use absolute for all (I knew there was a
reason that I did not do this, before I asked this question, but I am easily
persuaded as I am pretty new to this) because I have more than one
transaction in transactions and if I use absolute I get the same header on
all pages.  Each transaction/transaction will have a separate header.
Therefore xsl:copy and variable will not work either as the contents will
have to change.

You suggested passing "statement/accountInfo as a parameter into the
pagehead template "  I have used xsl:param, but am not sure how to use it in
this manner.  Are there any examples of this that I might look at?

I have posted a reduced version of this file xml and xslt below.  I would
appreciate any comments.  Thanks to all.   Tamre

<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="copy of statement4.xsl"?>

<stmtPeriod>04/01/01 - 04/30/01</stmtPeriod>
<text>Beginning Balance:</text>

<accttitle>Capital Account</accttitle>
<acctname>LOU MARKETS</acctname>
<address1>657 WALL ST</address1>
<address2>STE 18</address2>
<city>NEW YORK,</city>
<state> NY</state>
<zip> 10005</zip>

<transactions beginBal="123568.90">
<description>CLR BL99</description>
more "transaction" here
</accountInfo> end of this account

more accounts here.....


<?xml version="1.0"?>
<xsl:stylesheet version="1.0"

<xsl:output method="html"/>
<xsl:template match="/">
<xsl:for-each select="statement/accountInfo">

<xsl:call-template name="pagehead">

<xsl:call-template name="pagetable">

</xsl:for-each> <!--statement/accountInfo-->


<xsl:template name="pagehead">
<DIV style="position: relative; top:4px; width:4in;left:6in">

<xsl:value-of select="acctnum"/>

<span class="shiftright">
<xsl:value-of select="taxid"/>

<span class="shiftrightb">
<xsl:value-of select="/statement/stmtPeriod"/>

<DIV style="position: relative; height:.75in; width:3in;left -2px;top:10px;
font-size: 8pt; border:2px solid pink;">
<xsl:value-of select="acctname"/>
<xsl:value-of select="address1"/>
<xsl:value-of select="address2"/>
<xsl:value-of select="city"/>
<xsl:value-of select="state"/>
<xsl:value-of select="zip"/>

<DIV style="position: relative; height:.5in; width:4in;left:
<xsl:value-of select="/statement/title"/></h4>


<xsl:template name="pagetable">
<table id="table1">

<xsl:for-each select="transactions/transaction">

<xsl:variable name="rowsPerPage" select="8"/>

<xsl:call-template name="rowcount">

<xsl:if test="position() mod $rowsPerPage=0">

<xsl:text disable-output-escaping="yes">

<xsl:call-template name="pagehead">

<xsl:text disable-output-escaping="yes">

</xsl:for-each> <!--transactions/transaction-->


<xsl:template name="rowcount">

<td width="65px" align="left"><xsl:value-of select="date"/>&#xa0;</td>
<td width="70px"><xsl:value-of select="long"/>&#xa0;</td>
<td width="70px"><xsl:value-of select="short"/>&#xa0;</td>
<td width="225px"><xsl:value-of select="description"/>&#xa0;</td>
<td width="50px" align="center"><xsl:value-of

<td width="160px" align="right">

<xsl:value-of select="amount"/></td>



----- Original Message -----
From: "Trevor Nash" <tcn@xxxxxxxxxxxxx>
To: <xsl-list@xxxxxxxxxxxxxxxxxxxxxx>
Sent: Saturday, July 21, 2001 2:21 AM
Subject: Re: [xsl] Elements print sometimes only

> Tamre,
> >I have the following xsl file that prints a header, middle section and a
> >footer--on each page.  On the first page in the header area three
> >print out in a line, namely "acctnum", "taxid" and
> >as shown here:
> >
> In the text you say "statement/stmtPeriod" but in the template you add
> '/' on the front.  This may be an important difference.
> It looks like a problem with the current element, though its hard to
> be sure as you do not give us a sample of the input.
> Within the template "pagehead" you are referring to
> /statement/stmtPeriod which is an absolute path, so will work in
> whatever context pagehead is called.  But the things like "acctnum"
> are relative paths.  These will only produce something if when you
> call pagehead the current element has a child called "acctnum".
> You probably need to pass statement/accountInfo as a parameter into
> the pagehead template, or instead of saying 'acctnum' say
> '/statement/accountInfo/acctnum'.
> If the output from the pagehead template is the same for the whole
> run, then it may be better to put the contents in a global variable
> and copy that rather than doing a call-template.  Look up xsl:variable
> and xsl:copy-of.

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

Current Thread