Page 1 of 1
Upgrade from 8.1 & 8.2 breaks Saxon for debugging?
Posted: Tue May 22, 2007 1:11 am
by sfmoorex
I have a stylesheet that worked fine in the debugger with my earlier 8.x version, but as soon as I installed the 8.2 update, it started failing. I have also ran it without problems on 7.2 since I encountered the error. I'm using Saxon 8B. The error in 8.2 says:
Description: net.sf.saxon.type.ExternalObjectType cannot be cast to net.sf.saxon.type.BuiltInAtomicType
Posted: Tue May 22, 2007 9:53 am
by sorin_ristache
Hello,
Please post a sample for reproducing the error.
Regards,
Sorin
sample files attached
Posted: Tue May 22, 2007 6:31 pm
by sfmoorex
Sorry, I should have attached examples first, but I was exasperated and couldn't find where the potential problem might be. Part of the difficulty is that the error report does not point to a line number, so I had to find the problem in a large script. The problem is obviously in the interface to the external java.util.Hashtable class, but it worked properly with 7.2 and 8.1.
The stylesheet is below; the input document can be any valid XML.
Stylesheet:
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="2.0" xmlns:xsl="
http://www.w3.org/1999/XSL/Transform"
xmlns:dict="
http://www.jclark.com/xt/java/java.util.Hashtable"
exclude-result-prefixes="dict">
<xsl:variable name="dictionary" select="dict:new()"/>
<xsl:template match="/">
<xsl:if test="dict:put($dictionary,'aValue',0)"/>
<!-- Below is the offending line. If the equality test is removed, it compiles, but gives the wrong answer -->
<xsl:if test="dict:get($dictionary,'aValue')=0">
some text
</xsl:if>
other text
</xsl:template>
</xsl:stylesheet>
[/list]
Posted: Tue May 22, 2007 9:57 pm
by george
Hi,
Thanks for the example. The problem is in the latest version of Saxon 8.9.0.3 that oXygen 8.2 includes. I can reproduce that from command line:
Code: Select all
C:\Program Files\Oxygen XML Editor 8.2\lib>java -jar saxon8.jar test.xsl test.xsl
java.lang.ClassCastException: net.sf.saxon.type.ExternalObjectType
at net.sf.saxon.expr.GeneralComparison.typeCheck(GeneralComparison.java:136)
at net.sf.saxon.style.StyleElement.typeCheck(StyleElement.java:987)
at net.sf.saxon.style.XSLIf.validate(XSLIf.java:77)
at net.sf.saxon.style.StyleElement.validateSubtree(StyleElement.java:1208)
at net.sf.saxon.style.StyleElement.validateChildren(StyleElement.java:1237)
at net.sf.saxon.style.StyleElement.validateSubtree(StyleElement.java:1212)
at net.sf.saxon.style.XSLStylesheet.preprocess(XSLStylesheet.java:678)
at net.sf.saxon.PreparedStylesheet.setStylesheetDocument(PreparedStylesheet.java:313)
at net.sf.saxon.PreparedStylesheet.prepare(PreparedStylesheet.java:140)
at net.sf.saxon.TransformerFactoryImpl.newTemplates(TransformerFactoryImpl.java:137)
at net.sf.saxon.Transform.doTransform(Transform.java:489)
at net.sf.saxon.Transform.main(Transform.java:60)
Fatal error during transformation: java.lang.ClassCastException: net.sf.saxon.type.ExternalObjectType
We will notify Michael Kay about this and hopefully we will have soon a Saxon patch for this.
Thanks again for the sample code,
George
Posted: Tue May 22, 2007 11:43 pm
by sfmoorex
Thanks.
I reverted to Saxon 8.8 and it does indeed fix the problem , When the 8.9 patch arrives, I'll upgrade my Saxon.
Stephen
Posted: Wed May 23, 2007 2:53 pm
by george
Hi,
Got feedback from Michael Kay. The issue is a known problem fixed in the Saxon development stream, see
http://sourceforge.net/tracker/index.ph ... tid=397617
I prepared a patch for you. Please download the following file:
http://www.oxygenxml.com/update/patchSaxon8.9.0.3.zip
Then create in [oXygen]/lib folder a directory called
endorsed and place the above file in that directory.
There is however a problem with your stylesheet as the (citing Michael Kay) 'general operators like "=" are not defined on external objects.' so with the above patch you will get a nice error telling you that, see:
Description: Cannot perform comparisons involving external objects
URL:
http://www.w3.org/TR/xpath20/#ERRXPTY0004
Best Regards,
George
Posted: Wed May 23, 2007 7:33 pm
by sfmoorex
Well, at least I can find my errors. I think this is going to break a lot of stylesheets, but I do understand the rationale behind Kay's decision.
Thanks again for your help.