Link to home
Create AccountLog in
Avatar of piratepatrol
piratepatrolFlag for United States of America

asked on

Variable Reference Not in Scope

Hey guys,

I have this short XSLT snippet:

<?xml version="1.0"?>
<xsl:stylesheet version="2.0"
      exclude-result-prefixes="ms o x ss"
  <xsl:import href="file://C:/tibcoprojects/pnmr/SimpleSchedulingToolExternalFiles/XSLT/date.add.template.xsl" />
  <xsl:import href="file://C:/tibcoprojects/pnmr/SimpleSchedulingToolExternalFiles/XSLT/date.format-date.template.xsl" />
      <xsl:output method="xml" version="1.0" encoding="ISO-8859-1" omit-xml-declaration="no" standalone="no" indent="yes" doctype-system="schedules.dtd" />
      <xsl:variable name="intervalRow" as="xs:integer">3</xsl:variable>
      <xsl:variable name="defaultZone">NORTH</xsl:variable>
      <xsl:param name="worksheet">Balanced Schedule</xsl:param>
      <xsl:param name="flowDate" as="xs:date">
            <xsl:value-of select="substring(ms:Workbook/ms:Worksheet[@ss:Name=$worksheet]/ms:Table/ms:Row[$intervalRow - 1]/ms:Cell[1]/ms:Data[@ss:Type='DateTime'], 1, 10)"/>

The 2nd to the last night of this code blows up with the following exception:

Dynamic error in argument 1 to function fn:substring. Cause: variable reference with expanded-QName 'intervalRow' is not in scope.

Your help would be so appreciated.  Thank you so much.

Avatar of Gertone (Geert Bormans)
Gertone (Geert Bormans)
Flag of Belgium image

Link to home
Create an account to see this answer
Signing up is free. No credit card required.
Create Account
Avatar of piratepatrol


Hi Gertone,

Unfortunately, I still get the same error after implementing the above modification.  :(  Any other thoughts as to what is causing this weird exception?

Thanks so much,

I must admit that I lost sight of this question.
Is it solved.
I tried to reproduce it, and I could not... maybe if you sent the XML and the two imported xsls (just to make sure we are using the same copy)