This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Variable confusion
- From: Tompkins Tim <tim dot tompkins at barclaycard dot co dot uk>
- To: "'xsl-list at lists dot mulberrytech dot com'" <xsl-list at lists dot mulberrytech dot com>
- Date: Thu, 16 May 2002 15:20:10 +0100
- Subject: [xsl] Variable confusion
- Reply-to: xsl-list at lists dot mulberrytech dot com
Hi,
First post to this list so please be kind!
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.
The stylesheet starts like this...
<?xml version="1.0"?>
<!DOCTYPE storpres [<!ENTITY pound "£"><!ENTITY space " ">]>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html" indent="yes" encoding="UTF-8"/>
<xsl:variable name="pageNum" select="/storpres/est/general/trans-page"/>
<xsl:variable name="transactions-per-page">20</xsl:variable>
...
The first time I perform a transform the /storpres/est/general/trans-page is
1 and this is what is in $pageNum
The second time I run the transform the input xml is changed so
/storpres/est/general/trans-page is 2 but $pageNum is still 1?
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 understand xsl:variable is immutable within the stylesheet but not why I
can't change its value for subsequent transforms.
Has anyone any ideas why this is happening?
---
regards
Tim Tompkins
Legal Disclaimer:-
Internet communications are not secure and therefore the
Barclays Group does not accept legal responsibility for the
contents of this message. Although the Barclays Group
operates anti-virus programmes, it does not accept
responsibility for any damage whatsoever that is caused
by viruses being passed. Any views or opinions presented
are solely those of the author and do not necessarily
represent those of the Barclays Group.
Replies to this e-mail may be monitored by the Barclays
Group for operational or business reasons.
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list