Solved

How to reset xsl parameter values?

Posted on 2004-09-15
1
362 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

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…
Introduction In my previous article (http://www.experts-exchange.com/Microsoft/Development/MS-SQL-Server/SSIS/A_9150-Loading-XML-Using-SSIS.html) I showed you how the XML Source component can be used to load XML files into a SQL Server database, us…
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

932 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now