Project

Profile

Help

Problem with transformation

Added by Anonymous over 19 years ago

Legacy ID: #3025948 Legacy Poster: vguiraud (vguiraud)

Hello, I'm trying to use Saxon-B 8.3 to run a transformation (with an xsl stylesheet). If I want to get trace output from the transformation, it runs. But, when I run the same program without tracing transformation status (I only comment lines), an exception occurs : Hit uncaught exception java.lang.ArrayStoreException java.lang.ArrayStoreException at java.lang.System.arraycopy(Native Method) at net.sf.saxon.style.XSLChoose.compile(XSLChoose.java:193) at net.sf.saxon.style.StyleElement.compileSequenceConstructor(StyleElement.java:1315) at net.sf.saxon.style.XSLTemplate.compile(XSLTemplate.java:255) at net.sf.saxon.style.XSLStylesheet.compileStylesheet(XSLStylesheet.java:981) at net.sf.saxon.PreparedStylesheet.setStylesheetDocument(PreparedStylesheet.java:296) at net.sf.saxon.PreparedStylesheet.prepare(PreparedStylesheet.java:115) at net.sf.saxon.TransformerFactoryImpl.newTemplates(TransformerFactoryImpl.java:124) Here is the program : File iFile = new File("test.xsl"); System.setProperty("javax.xml.transform.TransformerFactory", "net.sf.saxon.TransformerFactoryImpl"); TransformerFactory tfactory = TransformerFactory.newInstance(); // Un-comment the following lines to get trace output from the transformation //tfactory.setAttribute(net.sf.saxon.FeatureKeys.TRACE_LISTENER, // new net.sf.saxon.trace.XSLTTraceListener()); Templates templates = tfactory.newTemplates(new StreamSource(iFile)); Transformer transformer = templates.newTransformer(); Can you help me to solve this problem ? Thanks a lot.


Replies (4)

Please register to reply

RE: Problem with transformation - Added by Anonymous over 19 years ago

Legacy ID: #3025969 Legacy Poster: Michael Kay (mhkay)

Thanks, this is a bug. If you can show the stylesheet, it would help me to describe the bug so that other people can recognize it. Looking at the code, there are two preconditions: (a) an xsl:choose statement in which one of the conditions is redundant (e.g. the xsl:when test can be evaluated to false at compile time) (b) the content of one of the branches of the xsl:choose has been reduced by the optimizer to an expression that isn't an instruction - e.g. it's an xsl:sequence. Michael Kay

RE: Problem with transformation - Added by Anonymous over 19 years ago

Legacy ID: #3027659 Legacy Poster: vguiraud (vguiraud)

Hello, here is a simplified stylesheet that provokes the exception java.lang.ArrayStoreException. I hope it will help you to solve this bug. Thanks. <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format"> <xsl:output method="xml" version="1.0" indent="no" omit-xml-declaration="yes"/> <xsl:variable name="var1" select="'var1'"/> <xsl:variable name="var2"> <xsl:variable name="root-start"> <xsl:value-of select="name(/[1])"/> </xsl:variable> <xsl:choose> <xsl:when test="$root-start='VALUE0'"> <xsl:choose> <xsl:when test="/[1][@ATTR1=1]">VALUE1</xsl:when> <xsl:when test="/*[1][@ATTR0=1]">VALUE2</xsl:when> <xsl:otherwise>VALUE3</xsl:otherwise> </xsl:choose> </xsl:when> <xsl:otherwise> <xsl:value-of select="$root-start"/> </xsl:otherwise> </xsl:choose> </xsl:variable> <xsl:template match="ELEM"> <xsl:choose> <xsl:when test="$var1='none'"> </xsl:when> <xsl:when test="$var2='var2'"> </xsl:when> <xsl:otherwise> </xsl:otherwise> </xsl:choose> </xsl:template> </xsl:stylesheet>

RE: Problem with transformation - Added by Anonymous over 19 years ago

Legacy ID: #3035895 Legacy Poster: vguiraud (vguiraud)

Hello, I sent you a simplified stylesheet last week which could show you the problem there is when you disable the trace listener. Have you found a solution in order to solve it ? Thanks a lot.

RE: Problem with transformation - Added by Anonymous over 19 years ago

Legacy ID: #3036408 Legacy Poster: Michael Kay (mhkay)

Sorry, I posted the bug description at https://sourceforge.net/tracker/index.php?func=detail&amp;aid=1155204&amp;group_id=29872&amp;atid=397617 but I should have also posted a cross-reference here. Michael Kay

    (1-4/4)

    Please register to reply