[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: Retaining value of a Global variable

Subject: RE: Retaining value of a Global variable
From: "Vivek Shinde" <Vivek.Shinde@xxxxxxx>
Date: Sat, 17 Jul 2004 02:20:33 -0400
vivek shinde
Hi Folks,
Thanks a lot for all your responses. Michael Kay has provided an alternative
of using position() function. What I am trying to do is display the category
heading only once if the article of that category is found.
Thanks again.
Vivek

-----Original Message-----
From: Vivek Shinde [mailto:Vivek.Shinde@xxxxxxx]
Sent: Friday, July 16, 2004 5:04 PM
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject:  Retaining value of a Global variable


Hi,

I have a global variable defined at the top of my stylesheet. When I try to
use it subsequently it gets reinitialized. Here's the code.

 <xsl:variable name="whead" select="'No'" />

<xsl:template match="/newsletter">
.
.
      <xsl:apply-templates select="content/article" mode="proc_webcastheader"
/>.

</xsl:template>

<xsl:template match="article" mode="proc_webcastheader"> <xsl:variable
name="artclass" select="normalize-space(metadata/article-classification/.)" />
<xsl:if test="contains($artclass,'Biz-Webcast')">
          <p><xsl:value-of disable-output-escaping="yes"
select="$whead"/></p>
          <IMG
src="http://www.sas.com/subscriptions/images/hdr_webcast.gif"></IMG>
          <xsl:variable name="whead" select="'Yes'" />
          <p><xsl:value-of disable-output-escaping="yes" select="$whead"/></p>
</xsl:if> </xsl:template>


In the second template when I print whead before the <img> it shows 'No' for
all articles even if I set it to 'Yes' after the <img>. Any clues on how to
retain the value of the variable?

Thanks
Vivek

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.