Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / First Aid / March 2005

Tip: Looking for answers? Try searching our database.

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

Thread view: 
RC - 29 Mar 2005 14:10 GMT
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!
kaeli - 29 Mar 2005 14:44 GMT
> In most of programming languages are VERY easy to do:
>
[quoted text clipped - 5 lines]
>
> 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

Signature

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

Anton Spaans - 29 Mar 2005 17:55 GMT
> Sorry Dudes,
>
[quoted text clipped - 18 lines]
>
> 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.
Bryce - 29 Mar 2005 20:35 GMT
>Sorry Dudes,
>
[quoted text clipped - 10 lines]
>
>But how can I do these in XSLT?

You can't.

>I got error when I do
>  <xsl:variable name="i" select='0' />
[quoted text clipped - 3 lines]
>
>Thank Q!

--
now with more cowbell


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.