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

Re: Variable confusion

Subject: Re: Variable confusion
From: Jeni Tennison <jeni@xxxxxxxxxxxxxxxx>
Date: Thu, 16 May 2002 16:59:42 +0100
Re:  Variable confusion
Hi Tim,

> I have a stylesheet with a global variable, the value of which is
> taken from the input source. It seems the first time I run a
> transform the variable is set correctly but on subsequent transforms
> it is not and it retains it's first value.
[snip]
> to prove it, later in the stylesheet I have...
>
> alert('pageNum='+<xsl:value-of select="$pageNum"/>+
>          ' trans-page='+<xsl:value-of
> select="storpres/est/general/trans-page"/>);
>
> This tells me pageNum=1 but trans-page=2.

I'm not sure whether it matters, but $pageNum is defined as
/storpres/est/general/trans-page -- an absolute path -- while your
xsl:value-of is giving the results of a relative path. If this alert
is being generated somewhere where the root node is the context, then
it doesn't matter at all, but somehow I doubt that's the problem.

You haven't told us the context in which you're using the stylesheet,
i.e. the code that you're using to invoke it, but I guess that you're
using MSXML from within a client-side script.

My guess would be that you're compiling the stylesheet once, and then
running it against two separate input files, and that somehow the
compiled stylesheet gets the value of the $pageNum fixed on the first
invocation, and isn't reset the second time. You could try using
the reset() method on the XSLProcessor object that you're using (if
you're using one) rather than just changing the value of the input
property, or you could create a new XSLProcessor for the second
transformation.

If that doesn't help, post the code that you're using to invoke the
XSLT processor and we'll have a look at it.

Cheers,

Jeni

---
Jeni Tennison
http://www.jenitennison.com/


 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.