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"
      xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
      xmlns:fn="http://www.w3.org/2005/02/xpath-functions"
      xmlns:xs="http://www.w3.org/2001/XMLSchema"
  xmlns:date="http://exslt.org/dates-and-times"
      xmlns:xdt="http://www.w3.org/2005/02/xpath-datatypes"
      xmlns:o="urn:schemas-microsoft-com:office:office"
       xmlns:x="urn:schemas-microsoft-com:office:excel"
      xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet"
      xmlns:ms="urn:schemas-microsoft-com:office:spreadsheet"
      xmlns:ercot="http://www.sungard.com/consulting/ercot"
      xmlns:util="http://www.sungard.com/consulting/util"
      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)"/>
      </xsl:param>

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.


Jazon
ASKER CERTIFIED SOLUTION
Avatar of Gertone (Geert Bormans)
Gertone (Geert Bormans)
Flag of Belgium image

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

ASKER

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,


Jazon
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)

cheers

Geert