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

RE: Reference to variable cannot be resolved.

Subject: RE: Reference to variable cannot be resolved.
From: "Dunning, John" <JDunning@xxxxxxxxx>
Date: Thu, 13 Feb 2003 13:31:45 -0500
cannot be resolved
Move
<xsl:variable name="ItemAStruct"
select="document('lookup.xml')/TableStructures/ItemA"/>

out of the first template, as it's not in scope when it is passed to the
second template, e.g.:

<xsl:stylesheet ...>
<xsl:variable name="ItemAStruct".../>
<xsl:template match="/">
</>
<xsl:template match="ItemAs">
</xsl:template>
</xsl:stylesheet>

HTH,
John

-----Original Message-----
From: Imrran Wahid [mailto:devguy2003@xxxxxxxxx]
Sent: Thursday, February 13, 2003 1:19 PM
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject:  Reference to variable cannot be resolved.


I get the following error when attempting to transform
an xml using IE 6.

"A reference to variable or parameter 'ItemAStruct'
cannot be resolved. The variable or parameter may not
be defined, or it may not be in scope."

Here's a snippet from my xsl:
<xsl:template match="/">
  <html>
   <body bgcolor="#B0C4DE">
    <xsl:variable name="ItemAStruct"
select="document('lookup.xml')/TableStructures/ItemA"/>
    
    <xsl:apply-templates select="//Content/ItemAs" /> 
  </body>
  </html>
</xsl:template>

<xsl:template match="ItemAs">
  <xsl:variable name="ItemAs" select="."/>
  <!-- process each ItemA element from lookup.xml -->
  <tr>
  <xsl:for-each select="$ItemAStruct">
    <xsl:variable name="ItemName"
select="string(name(.))"/>
    <xsl:if test="count($ItemAs/*[name(.)=$ItemName])
&gt; 0">
      <th><xsl:value-of select="$ItemName"/></th>
    </xsl:if>
  </xsl:for-each>
  </tr>
</xsl:template>
</xsl:stylesheet>


Can anyone spot the culprit?
Imrran



__________________________________________________
Do you Yahoo!?
Yahoo! Shopping - Send Flowers for Valentine's Day
http://shopping.yahoo.com

 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.