[
http://issues.apache.org/jira/browse/XALANJ-2311?page=comments#action_12443076
]
Henry Zongaro commented on XALANJ-2311:
---------------------------------------
I tried invoking the supplied stylesheet using the Process command, and got the
following errors:
file:///d:/henry/defects/j2311/bigtemplate.xml; Line #396; Column #89; XSLT
Error (javax.xml.transform.TransformerConfigurationException):
javax.xml.transform.TransformerException:
javax.xml.transform.TransformerException: xsl:for is not allowed in this
position in the stylesheet!
Exception in thread "main" java.lang.RuntimeException:
javax.xml.transform.TranformerException:
javax.xml.transform.TransformerException: xsl:for is not allowed in this
position in the stylesheet!
at org.apache.xalan.xslt.Process.doExit(Process.java:1167)
at org.apache.xalan.xslt.Process.main(Process.java:1140)
I then wrote a Java program that installed an ErrorListener on the
TransformerFactory to see how the error was being reported, and found it was
reported using the ErrorListener.error method.
I see in your sample code, you're using an ErrorListener implementation named
ru.arptek.arpsite.xslt.DefaultErrorHandler. You didn't provide the source for
that, but I'm guessing that it ignores calls to its warning and error methods,
and only reports fatalErrors. Is that true?
In any event, it seems that the error message you've requested is already being
reported, but it looks like the processor is attempting to recover by ignoring
the xsl:for element. I think it should be reporting this as a fatalError
instead, and should not attempt to recover, unless the element is covered by
forwards compatible behaviour. (See XSLT 1.0 section 2.5.)
In any event, I think the severity of this bug report should be reduced.
> Wrong error about missing template
> ----------------------------------
>
> Key: XALANJ-2311
> URL: http://issues.apache.org/jira/browse/XALANJ-2311
> Project: XalanJ2
> Issue Type: Bug
> Components: Xalan
> Affects Versions: 2.7
> Environment: Xalan 2.7.0, Bundled Xerces, J2SE 1.5.0 and 1.6beta
> Reporter: Sergey Vladimirov
> Priority: Critical
> Attachments: bigtemplate.xsl, BigTemplateTest.java,
> BigTemplateTest.java
>
>
> xalan wrongly reports about missing template:
> ru.arptek.arpsite.templates.TemplateProcessException: Detected error in
> stylesheets:
> C:\DOCUME~1\VLADIM~1.AVD\LOCALS~1\Temp\bigtemplate7628.xsl
> javax.xml.transform.TransformerException:
> javax.xml.transform.TransformerException: ?????? ElemTemplateElement: Footer
> ==========================================================================================
> <xsl:with-param name="contentDescription"
> select="$contentDescription"/>
> </xsl:call-template>
> <xsl:call-template name="Footer"/>
> </xsl:if>
> </body>
> ==========================================================================================
> at
> ru.arptek.arpsite.xslt.DefaultErrorHandler.wrap(DefaultErrorHandler.java:147)
> at
> ru.arptek.arpsite.xslt.bigtemplatetest.BigTemplateTest.test(BigTemplateTest.java:31)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> at java.lang.reflect.Method.invoke(Method.java:589)
> at junit.framework.TestCase.runTest(TestCase.java:154)
> at junit.framework.TestCase.runBare(TestCase.java:127)
> at junit.framework.TestResult$1.protect(TestResult.java:106)
> at junit.framework.TestResult.runProtected(TestResult.java:124)
> at junit.framework.TestResult.run(TestResult.java:109)
> at junit.framework.TestCase.run(TestCase.java:118)
> at junit.framework.TestSuite.runTest(TestSuite.java:208)
> at junit.framework.TestSuite.run(TestSuite.java:203)
> at
> org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:128)
> at
> org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
> at
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
> at
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
> at
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
> at
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
> Caused by: javax.xml.transform.TransformerException: ??????
> ElemTemplateElement: Footer
> at
> org.apache.xalan.templates.ElemCallTemplate.compose(ElemCallTemplate.java:134)
> at
> org.apache.xalan.templates.StylesheetRoot.composeTemplates(StylesheetRoot.java:357)
> at
> org.apache.xalan.templates.StylesheetRoot.composeTemplates(StylesheetRoot.java:362)
> at
> org.apache.xalan.templates.StylesheetRoot.composeTemplates(StylesheetRoot.java:362)
> at
> org.apache.xalan.templates.StylesheetRoot.composeTemplates(StylesheetRoot.java:362)
> at
> org.apache.xalan.templates.StylesheetRoot.composeTemplates(StylesheetRoot.java:362)
> at
> org.apache.xalan.templates.StylesheetRoot.composeTemplates(StylesheetRoot.java:362)
> at
> org.apache.xalan.templates.StylesheetRoot.recompose(StylesheetRoot.java:337)
> at
> org.apache.xalan.processor.StylesheetHandler.endDocument(StylesheetHandler.java:468)
> at org.apache.xerces.parsers.AbstractSAXParser.endDocument(Unknown
> Source)
> at org.apache.xerces.impl.XMLDocumentScannerImpl.endEntity(Unknown
> Source)
> at org.apache.xerces.impl.XMLEntityManager.endEntity(Unknown Source)
> at org.apache.xerces.impl.XMLEntityScanner.load(Unknown Source)
> at org.apache.xerces.impl.XMLEntityScanner.skipSpaces(Unknown Source)
> at
> org.apache.xerces.impl.XMLDocumentScannerImpl$TrailingMiscDispatcher.dispatch(Unknown
> Source)
> at
> org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown
> Source)
> at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
> at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
> at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
> at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
> at org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown
> Source)
> at
> org.apache.xalan.processor.TransformerFactoryImpl.newTemplates(TransformerFactoryImpl.java:920)
> at
> ru.arptek.arpsite.xslt.bigtemplatetest.BigTemplateTest.test(BigTemplateTest.java:29)
> ... 18 more
> (Wrapping error to output additional information by our code :) )
> This template ("Footer") present in stylesheet. Once.
> Why I'm sure that it is a bug? Because workaround is - to move this template
> UP, more closely to caller.
> But I can't do it with every template. So it is critical to me.
--
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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]