Solved

How to reset xsl parameter values?

Posted on 2004-09-15
1
363 Views
Last Modified: 2006-11-17
Good morning,

I am new to XML and XSL.  I am currently working on an XSL stylesheet and I need to know how to use a parameter locally and reset the values for use later.  Here is an example of what I'm trying to do:

<xsl:param name="querystring">not set yet</xsl:param>

<xsl:choose>
   <xsl:when test="@file_type='File'">
      <!--I want to set the "querystring" variable to a specific text value -->
   </xsl:when>
   <xsl:when test="@file_type='Date'">
      <!--I want to set the "querystring" variable to a specific text value-->
   </xsl:when>
   <xsl:otherwise>
      <!--I want to set the "querystring" variable to a specific text value-->
   </xsl:otherwise>
</xsl:choose>

<!--Then I want to use this variable to populate the HTML cell -->
<td><xsl:value-of select ="{$querystring}"/></td>  <!--Is that right?-->

Thanks
0
Comment
Question by:dentyne
1 Comment
 
LVL 26

Accepted Solution

by:
rdcpro earned 50 total points
ID: 12070133
Once a variable or parameter is set in XSLT, it is immutable and cannot be changed.  This is a consequence of the fact that XSLT is declarative.  Procedural programming techniques do not work well in XSLT--it's a lot different than things you might have tried before.  

Now, in a new instance of a template, a variable or parameter of the same name is a *new* variable or parameter, and can have a different value.  That's why we use recursion in XSLT to achieve this sort of thing.  For example:

http://rdcpro.com/Members/rdcpro/snippets/recursionandcounting/

What exactly are you trying to do with this?

Regards,
Mike Sharp
0

Featured Post

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The Client Need Led Us to RSS I recently had an investment company ask me how they might notify their constituents about their newsworthy publications.  Probably you would think "Facebook" or "Twitter" but this is an interesting client.  Their cons…
Many times as a report developer I've been asked to display normalized data such as three rows with values Jack, Joe, and Bob as a single comma-separated string such as 'Jack, Joe, Bob', and vice versa.  Here's how to do it. 
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question