This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Variable confusion


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 "&#163;"><!ENTITY space "&#160;">]>
<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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]