xsl-list
[Top] [All Lists]

Import and variables

2003-01-08 08:52:22
I have 2 xsl files.

<!-- testvar.xsl -->
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>
<xsl:output method="xml" indent="no"/>
<xsl:strip-space elements="*"/>
<xsl:variable name="rowbreak" select="0"/>
<xsl:variable name="size_header" select="0"/>
<xsl:variable name="size_footer" select="0"/>
</xsl:stylesheet>

and

<!-- testvar.xsl -->
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>
<!-- ********************************************* -->
<xsl:import href="testvar.xsl"/>
<!-- ********************************************* -->
<!-- These variables should override the ones in testvar.xsl
<xsl:variable name="size_header" select="19"/>
<xsl:variable name="size_footer" select="6"/>
<xsl:variable name="rowbreak" select="32"/>
<!-- ********************************************* -->
</xsl:stylesheet>

I define some variables in the imported xslt file that need to be changed by
variables in my new main xslt
This is offcourse a test. In my real program, testvar will test if
size_header <> 0 and process accordingly.
Sometimes testvar2.xsl will have these variables and other times not. But
testvar.xsl does tests on them so they need to be there.

Running this gives an error in saxon
C:\temp\INSTAN~1>saxon phonelist.xml testvar2.xsl
java.lang.IllegalArgumentException: Can't define local variable: stack is
empty
        at com/icl/saxon/Bindery.defineLocalVariable
        at com/icl/saxon/style/XSLVariable.process
        at com/icl/saxon/style/XSLStyleSheet.process
        at com/icl/saxon/Controller.transformDocument
        at com/icl/saxon/Controller.transform
        at com/icl/saxon/StyleSheet.processFile
        at com/icl/saxon/StyleSheet.doMain
        at com/icl/saxon/WinStyleSheet.main

How can i make import and override variables work?
Joeri



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



<Prev in Thread] Current Thread [Next in Thread>