473,473 Members | 2,215 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

How to re-asign a value to a variable in XSLT

RC
Sorry Dudes,

I couldn't find an appropriate group to post about XML/XSLT issues.
I can only post to these close groups.

In most of programming languages are VERY easy to do:

int i = 0;
i = 3;
i = i + 1;
i += 2;
i++;

But how can I do these in XSLT?

I got error when I do
<xsl:variable name="i" select='0' />
<xsl:variable name="i" select="$i + '1' />

Can dudes (American West Coast's Term) out there can help?

Thank Q!
Jul 21 '05 #1
3 2197
In article <d2**********@news.nems.noaa.gov>, ra**********@noaa.gov
enlightened us with...

In most of programming languages are VERY easy to do:

int i = 0;
i = 3;
i = i + 1;
i += 2;
i++;

But how can I do these in XSLT?


You really shouldn't, even if you can.
Here's a great explanation why.

[quote src=http://www.xslt.com/html/xsl-list/2002-04/msg00185.html]
However, it's very dangerous to use extension functions or extension
elements that have side-effects in XSLT, such as counters or
extensions that read and update databases. This is because XSLT is
designed around the basic assumption that you can evaluate the same
expression multiple times without affecting the result of that or
other expressions.
[/quote]

More points made there, too. Check out the full link.
http://www.xslt.com/html/xsl-list/2002-04/msg00185.html

--
--
~kaeli~
Reading while sunbathing makes you well red.
http://www.ipwebdesign.net/wildAtHeart
http://www.ipwebdesign.net/kaelisSpace

Jul 21 '05 #2

"RC" <ra**********@noaa.gov> wrote in message
news:d2**********@news.nems.noaa.gov...
Sorry Dudes,

I couldn't find an appropriate group to post about XML/XSLT issues.
I can only post to these close groups.

In most of programming languages are VERY easy to do:

int i = 0;
i = 3;
i = i + 1;
i += 2;
i++;

But how can I do these in XSLT?

I got error when I do
<xsl:variable name="i" select='0' />
<xsl:variable name="i" select="$i + '1' />

Can dudes (American West Coast's Term) out there can help?

Thank Q!


As the previous poster said as well, XSL is designed as a Meta Language, a
pure functional language that does not allow for so-called 'side-effects'.
Such languages are purely declarative in nature, allowing its
interpreters/compilers for any valid possible optimization that the
interpreters/compilers can come up with and no unpredictable side-effects
are introduced.
Take a look at this link:
http://www.kuro5hin.org/story/2002/1/13/223854/606

-- Anton Spaans.
Jul 21 '05 #3
On Tue, 29 Mar 2005 08:10:10 -0500, RC <ra**********@noaa.gov> wrote:
Sorry Dudes,

I couldn't find an appropriate group to post about XML/XSLT issues.
I can only post to these close groups.

In most of programming languages are VERY easy to do:

int i = 0;
i = 3;
i = i + 1;
i += 2;
i++;

But how can I do these in XSLT?
You can't.
I got error when I do
<xsl:variable name="i" select='0' />
<xsl:variable name="i" select="$i + '1' />

Can dudes (American West Coast's Term) out there can help?

Thank Q!

--
now with more cowbell
Jul 21 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Craig Bailey | last post by:
Anyone recommend a good script editor for Mac OS X? Just finished a 4-day PHP class in front of a Windows machine, and liked the editor we used. Don't recall the name, but it gave line numbers as...
1
by: Chris | last post by:
Sorry to post so much code all at once but I'm banging my head against the wall trying to get this to work! Does anyone have any idea where I'm going wrong? Thanks in advance and sorry again...
11
by: James | last post by:
My form and results are on one page. If I use : if ($Company) { $query = "Select Company, Contact From tblworking Where ID = $Company Order By Company ASC"; }
4
by: Alan Walkington | last post by:
Folks: How can I get an /exec'ed/ process to run in the background on an XP box? I have a monitor-like process which I am starting as 'exec("something.exe");' and, of course the exec function...
1
by: John Ryan | last post by:
What PHP code would I use to check if submitted sites to my directory actually exist?? I want to use something that can return the server code to me, ie HTTP 300 OK, or whatever. Can I do this with...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.