Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

How to reset xsl parameter values?

Posted on 2004-09-15
1
Medium Priority
?
369 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 200 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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
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. 
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Are you ready to place your question in front of subject-matter experts for more timely responses? With the release of Priority Question, Premium Members, Team Accounts and Qualified Experts can now identify the emergent level of their issue, signal…

963 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