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

RE: newbie variable question

Subject: RE: newbie variable question
From: Don Bruey <dbruey@xxxxxxxxxxxxxxxxxxxxx>
Date: Tue, 26 Sep 2000 13:40:19 -0400
RE: newbie variable question
You're creating the variable within an <xsl:if> block.  The error message is
correct, it's out of scope at the time you test it. </xsl:if> ends this
variable's lifetime.

Don



> -----Original Message-----
> From: Les Howard [mailto:les@xxxxxxxxxxxxxxx]
> Sent: Tuesday, September 26, 2000 12:02 PM
> To: XSL-List@xxxxxxxxxxxxxxxx
> Subject: newbie variable question
> 
> 
> I'm an XSLT newbie.  I've been trying to get this one thing 
> to work for
> a while now and I just can't get it to work.  I'd apreciate any help
> that anyone can provide:
> 
> What I am trying to do is:
> if there are any grp/type element whose contents are "DMA" I want to
> print out the value of the associated name in that grp.  if 
> there is no
> grp/type element whose contents is "DMA" I want to print out 
> the values
> of the description element.
> 
> my XML that looks like this:
> 
>      <area>
>        <grp>
>          <type>MSA</type>
>          <name>foo</type>
>        </grp>
>        <grp>
>          <type>DMA</type>
>          <name>bar</type>
>        </grp>
>      </area>
>      <description>baz</description>
> 
> and the XSLT I'm working with looks like this
> 
>   <xsl:for-each select="area/grp">
>     <xsl:if test="string(type)='DMA'">
>       <xsl:value-of select="name"/>
>      <xsl:variable name="ValueExists" select="'True'"/>
>     </xsl:if>
>   </xsl:for-each>
> <xsl:if  test="$ValueExists!="'True'">
>  <xsl:value-of select="description" />
> </xsl:if>
> 
> 
> but I keep getting an error:
> 
> A reference to variable or parameter 'ValueExists' cannot be resolved.
> The variable or parameter may not be defined, or it may not 
> be in scope.
> 
> I'm using the MS XSLT translator.  Thanks for any help you 
> can provide,
> 
> Les
> 
> 
>  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
> 


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


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.