Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XSLT
|
XSLT General questions and answers about XSLT. For issues strictly specific to the book XSLT 1.1 Programmers Reference, please post to that forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XSLT section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old February 9th, 2007, 03:04 PM
Authorized User
 
Join Date: Feb 2007
Posts: 51
Thanks: 3
Thanked 0 Times in 0 Posts
Default How to increment/decrement a parameter in XSL

Hello,
I have a need to increase and decrease a column position variable in XSLT. HTML cells are generated from an xsl:apply-templates construct that recursively traverses hierarchically-arranged elements in the corresponding XML file. The problem I face is not knowing how, in XSLT, to maintain a column position value as the tree nodes are added (and as the template is repeatedly called from itself).

In other words, the column value would grow and shrink depending on the where the element is in the hierarchy. In java I could do this easily, but am struggling to do the same thing in XSLT. Any insights are greatly appreciated. Thanks.

 
Old February 9th, 2007, 03:46 PM
mhkay's Avatar
Wrox Author
 
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

You can't change the values of variables in a declarative language. So the answer to your question is that you need to think about the problem a different way. If you describe the problem, rather than the way you would tackle it in Java, then it might be possible to suggest the right approach in XSLT.

However, you're already using recursion so it seems you are part way there. Usually in this kind of problem it's just a question of calculating the values of parameters to pass to the recursive templates.

Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference
 
Old February 9th, 2007, 04:24 PM
Authorized User
 
Join Date: Feb 2007
Posts: 51
Thanks: 3
Thanked 0 Times in 0 Posts
Default

Totally figured it out on my own. Thanks for assistance ;)






Similar Threads
Thread Thread Starter Forum Replies Last Post
Post a parameter to XSL in Safari Jason.Shang Javascript 0 August 18th, 2008 09:06 PM
Pass link values as xsl:parameter to php5 then xsl pauljr8 XSLT 1 July 2nd, 2007 10:32 PM
XSL - Parameter query. Neal XSLT 4 January 24th, 2006 01:27 PM
how to build a JavaScript for loop decrement (--) crmpicco Javascript How-To 2 November 15th, 2005 12:24 PM
XSL Parameter xsl:param Harinath Chikoti XSLT 1 May 6th, 2005 03:15 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.