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

Problems still with elements print first page only

Subject: Problems still with elements print first page only
From: "Tamre Bond" <tamre2@xxxxxxx>
Date: Sun, 22 Jul 2001 14:18:42 -0700
print problems style position relative
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">
 to
 <xsl:for-each select="transactions/transaction">
 to
 </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"?>

<statement>
<title>CAPITAL ACCOUNT STATEMENT</title>
<stmtPeriod>04/01/01 - 04/30/01</stmtPeriod>
<text>Beginning Balance:</text>

<accountInfo>
<acctnum>7BR7</acctnum>
<accttitle>Capital Account</accttitle>
<taxid>13-4055774</taxid>
<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">
<transaction>
<date>04/02/01</date>
<long>1</long>
<short></short>
<description>CLR BL99</description>
<priceCode>CLR</priceCode>
<amount>122.50</amount>
<ledgerBalance></ledgerBalance>
</transaction>
more "transaction" here
</transactions>
</accountInfo> end of this account

more accounts here.....

</statement>

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

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

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

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

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

</body>
</html>
</xsl:template>

<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>

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


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


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

</xsl:template>

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

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

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

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

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

<xsl:text disable-output-escaping="yes">
<![CDATA[</table></DIV>]]>
</xsl:text>


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

<xsl:text disable-output-escaping="yes">
<![CDATA[<DIV><table>]]>
</xsl:text>
</xsl:if>

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

</table>
</DIV>
</xsl:template>


<xsl:template name="rowcount">
<tr>

<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
select="priceCode"/>&#xa0;</td>

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

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

</tr>
</xsl:template>

</xsl:stylesheet>


----- Original Message -----
From: "Trevor Nash" <tcn@xxxxxxxxxxxxx>
To: <xsl-list@xxxxxxxxxxxxxxxxxxxxxx>
Sent: Saturday, July 21, 2001 2:21 AM
Subject: Re:  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
elements
> >print out in a line, namely "acctnum", "taxid" and
"statement/stmtPeriod",
> >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

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.