Project

Profile

Help

java.lang.IllegalStateException: getPosture() called when streamability has not yet been computed in stylesheet trying to use streaming

Added by Martin Honnen over 8 years ago

As long as @xsl:fork@ with @xsl:for-each-group group-by@ is not yet supported, I was wondering whether I could use a single stylesheet to stream through the same document several times, trying to collect grouping keys first and then collecting the grouping population for each key in a separate @xsl:stream@s, creating a result document for each key. However while Saxon seems to allow me to have two hard-coded, separate @xsl:stream@ for the same @href@ URI, any attempt to use a programmatic approach with a variable has failed, I get an exception

java.lang.IllegalStateException: getPosture() called when streamability has not yet been computed in stylesheet trying to use streaming

Here is one attempt that causes that exception:




  







  
    
    
      
        
          
            
          
        
      
    
  



An input sample is




  
    ...
  
  
    ...
  
  
    ...
  
  
    ...
  
  
    ...
  

The full output with stack trace when running Saxon 9.7 EE from the command line (@-it -xsl:sheet.xsl -t@):

Saxon-EE 9.7.0.1J from Saxonica
Java version 1.8.0_66
java.lang.IllegalStateException: getPosture() called when streamability has not yet been computed
        at net.sf.saxon.expr.Expression.getPosture(Expression.java:1625)
        at com.saxonica.ee.stream.adjunct.VariableReferenceAdjunct.computeStreamability(VariableReferenceAdjunct.java:38
)
        at net.sf.saxon.expr.Expression.getStreamability(Expression.java:1613)
        at com.saxonica.ee.stream.Streamability.generalStreamabilityRules(Streamability.java:136)
        at com.saxonica.ee.stream.adjunct.StreamingAdjunct.computeStreamability(StreamingAdjunct.java:106)
        at net.sf.saxon.expr.Expression.getStreamability(Expression.java:1613)
        at com.saxonica.ee.stream.adjunct.FilterExpressionAdjunct.computeStreamability(FilterExpressionAdjunct.java:39)
        at net.sf.saxon.expr.Expression.getStreamability(Expression.java:1613)
        at com.saxonica.ee.stream.adjunct.ForEachAdjunct.getStreamability(ForEachAdjunct.java:168)
        at com.saxonica.ee.stream.adjunct.ForEachAdjunct.computeStreamability(ForEachAdjunct.java:154)
        at net.sf.saxon.expr.Expression.getStreamability(Expression.java:1613)
        at com.saxonica.ee.stream.StreamInstr.prepareForStreaming(StreamInstr.java:173)
        at com.saxonica.ee.stream.StreamInstr.optimize(StreamInstr.java:147)
        at net.sf.saxon.expr.Operand.optimize(Operand.java:200)
        at net.sf.saxon.expr.Expression.optimizeChildren(Expression.java:496)
        at net.sf.saxon.expr.instruct.ParentNodeConstructor.optimize(ParentNodeConstructor.java:209)
        at net.sf.saxon.expr.instruct.FixedElement.optimize(FixedElement.java:106)
        at net.sf.saxon.expr.Operand.optimize(Operand.java:200)
        at net.sf.saxon.expr.Expression.optimizeChildren(Expression.java:496)
        at net.sf.saxon.expr.Expression.optimize(Expression.java:475)
        at net.sf.saxon.expr.Operand.optimize(Operand.java:200)
        at net.sf.saxon.expr.LetExpression.optimize(LetExpression.java:277)
        at net.sf.saxon.expr.Operand.optimize(Operand.java:200)
        at com.saxonica.xslt3.instruct.IterateInstr.optimize(IterateInstr.java:144)
        at net.sf.saxon.style.XSLTemplate.optimize(XSLTemplate.java:751)
        at net.sf.saxon.style.PrincipalStylesheetModule.optimizeTopLevel(PrincipalStylesheetModule.java:1348)
        at net.sf.saxon.style.PrincipalStylesheetModule.compile(PrincipalStylesheetModule.java:1198)
        at net.sf.saxon.style.Compilation.compilePackage(Compilation.java:244)
        at net.sf.saxon.style.StylesheetModule.loadStylesheet(StylesheetModule.java:256)
        at net.sf.saxon.style.Compilation.compileSingletonPackage(Compilation.java:101)
        at net.sf.saxon.s9api.XsltCompiler.compile(XsltCompiler.java:777)
        at net.sf.saxon.Transform.doTransform(Transform.java:697)
        at net.sf.saxon.Transform.main(Transform.java:77)
Fatal error during transformation: java.lang.IllegalStateException: getPosture() called when streamability has not yet been computed

    (1-1/1)

    Please register to reply