You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xalan.apache.org by "Brian Minchau (JIRA)" <xa...@xml.apache.org> on 2006/10/17 18:16:36 UTC
[jira] Commented: (XALANJ-2325) XSLTC Causes NoSuchFieldError if
global variable is unused
[ http://issues.apache.org/jira/browse/XALANJ-2325?page=comments#action_12442959 ]
Brian Minchau commented on XALANJ-2325:
---------------------------------------
Per the JIRA triage meeting on Oct 16, 2005, Santiago P-G agreed to review the patch and see if it is robust.
If the patch is not good then it will probably not be re-worked.
> XSLTC Causes NoSuchFieldError if global variable is unused
> ----------------------------------------------------------
>
> Key: XALANJ-2325
> URL: http://issues.apache.org/jira/browse/XALANJ-2325
> Project: XalanJ2
> Issue Type: Bug
> Components: XSLTC
> Affects Versions: 2.7
> Environment: Windows 2003, JRE 1.4.
> Reporter: Fred Kruesi
> Attachments: TestXsl.zip, variable.patch
>
>
> If one has a style sheet that imports other style sheets which further include other style sheets and the last imported style sheet does not use a global variable it declared, XSLTC discards the variable even though it is used by other sheets. This leads to a NoSuchFieldError when the sheet is used. Following is a schematic view of the sheets. The actual sheets are in a test case.
> foo.xsl:
> <xsl:import href="imported/import1.xsl"/>
> <xsl:import href="imported/import2.xsl"/>
> <xsl:template match="bar:element">
> Value of info: <xsl:value-of select="info"/>
> Value of my-var from import: <xsl:call-template name="import1.xsl"/>
> Value of my-var from import: <xsl:call-template name="import2.xsl"/>
> </xsl:template>
> imported/import1.xsl:
> <xsl:include href="../inc1/inc1a.xsl"/>
>
> <xsl:template name="import1.xsl">
> From import1 my-var: <xsl:value-of select="$my-var"/>
> </xsl:template>
> imported/import2.xsl:
> <xsl:include href="../inc1/inc1a.xsl"/>
>
> <xsl:template name="import2.xsl">
> From import2 my-var:
> </xsl:template>
> ../inc1/inc1a.xsl
> <xsl:variable name="my-var">
> <Data code="Y">
> <Desc>Yes</Desc>
> </Data>
> <Data code="N">
> <Desc>No</Desc>
> </Data>
> </xsl:variable>
> Note that imported/import2 does declares, but does not use "my-var". When run, the following trace is produced:
> java.lang.NoSuchFieldError: my$dash$var
> at com.gmaci.xsl.foo.import1$dot$xsl()
> at com.gmaci.xsl.foo.template$dot$2()
> at com.gmaci.xsl.foo.applyTemplates()
> at com.gmaci.xsl.foo.applyTemplates()
> at com.gmaci.xsl.foo.applyTemplates()
> at com.gmaci.xsl.foo.transform()
> at org.apache.xalan.xsltc.runtime.AbstractTranslet.transform(AbstractTranslet.java:593)
> at org.apache.xalan.xsltc.trax.TransformerImpl.transform(TransformerImpl.java:630)
> at org.apache.xalan.xsltc.trax.TransformerImpl.transform(TransformerImpl.java:301)
> at testXsl.TestDriver.doTransform(TestDriver.java:233)
> at testXsl.TestDriver.main(TestDriver.java:69)
> Exception in thread "main"
> An obvious work-around is to ensure all global variables are used. A patch is attached. The thrust of the patch is to discard unused local variables, but not to discard any global variables.
> A test case can be provided. In order to use the test case you need to add the following jars to the lib folder of the project.
> xalan
> jdom
> serializer
> resolver
> xlm-apis
> xercesImpl
> xsltc
>
> To run the test, execute the Ant script.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: xalan-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-dev-help@xml.apache.org