This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Re: Elements print sometimes only
Trevor,
Thanks for the advice. That did work. I was confused because it does print
the first time through, but then when it recalls the template it is in
another spot so to speak and I therefore need to be more clear on the path.
Thanks for the other info as well. I will check out the global variable
possibilities and also minimize code before I post it.
Thank you again. Tamre
----- Original Message -----
From: "Trevor Nash" <tcn@melvaig.co.uk>
To: <xsl-list@lists.mulberrytech.com>
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
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:template name="pagehead">
> ><DIV style="position: relative; top:4px;">
> ><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>
> >
> >but when this is called the second time through, only the
> >"statement/stmtPeriod" prints out. I have not been able to figure this
out.
> >Any ideas? I have posted the entire file below, in case it will be
helpful.
>
> The most helpful thing you (and others) can do is first reduce the
> stylesheet and input to give something that is easy to test. Make
> sure what you post still does what you claim - test it yourself first.
>
> Often this process of elimination will reveal the answer without
> having to post at all.
>
> >Thanks. Tamre
> >
>
> Regards,
> Trevor Nash
> --
> Traditional training & distance learning,
> Consultancy by email
>
> Melvaig Software Engineering Limited
> voice: +44 (0) 1445 771 271
> email: tcn@melvaig.co.uk
>
> XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
>
>
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list