Solved

How to reset xsl parameter values?

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

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
XSD Data to SQL Tables 2 21
parsing xml in javascript 2 33
Convert XSD to XML 3 72
Getting attribute Values using xslt 4 34
Browsing the questions asked to the Experts of this forum, you will be amazed to see how many times people are headaching about monster regular expressions (regex) to select that specific part of some HTML or XML file they want to extract. The examp…
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.
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

705 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

14 Experts available now in Live!

Get 1:1 Help Now