Project

Profile

Help

Not able to use burst-mode streaming with saxon9.7.0.12

Added by Susan Chen about 7 years ago

Hi, I wanted to use burst-mode streaming like the example described here: http://saxonica.com/documentation/index.html#!sourcedocs/streaming/burst-mode-streaming So I have code look like this: @ <xsl:mode streamable="yes"/> <xsl:template match="/"> <xsl:apply-templates select="/ab:Workers/ab:Worker_Record/copy-of(.)"/> </xsl:template> <xsl:template match="ab:Worker_Record"> <xsl:if test="number(count(ab:Coverage/*)) > 0 and ab:PersonalData/ab:WorkerType='FullTime'"> ab:includeworker <xsl:value-of select="true()"/> </ab:includeworker> </xsl:if> </xsl:template>@

It gives me error that my template does not satisfy the streamability rules: XTSE3430: Template rule is declared streamable but it does not satisfy the streamability rules. * There is more than one consuming operand: {number(...) gt 0} and {PersonalData/WorkerType = "FullTime"}, both on line 19

So I used workaround suggested in the following doc to assign mode to template then burst-mode streaming starts working just fine: @ <xsl:mode streamable="yes"/> <xsl:template match="/"> <xsl:apply-templates select="/ab:Workers/ab:Worker_Record/copy-of(.)" mode="fnc1" /> </xsl:template> <xsl:template match="ab:Worker_Record" mode="fnc1"> <xsl:if test="number(count(ab:Coverage/*)) > 0 and ab:PersonalData/ab:WorkerType='FullTime'"> ab:includeworker <xsl:value-of select="true()"/> </ab:includeworker> </xsl:if> </xsl:template>@

When i looked up the similar issue from stackoverflow, and I see there was similar bug reported and fixed in both 9.6 and 9.7. I am using saxon9.7.0.12, do you know which version was this bug fixed? Or if i am not doing burst mode streaming correctly? Appreciate any help or feedback! Bug I found related to my issue: https://saxonica.plan.io/issues/2171


Replies (4)

Please register to reply

RE: Not able to use burst-mode streaming with saxon9.7.0.12 - Added by Michael Kay about 7 years ago

I would strongly encourage you to move to the latest Saxon 9.8 maintenance release for any streaming applications, as a very large number of test cases were added in the period since 9.7 release, and in fact it is known that many of those tests cannot be handled by Saxon 9.7.

However, I think this one is an error on your part. You have implicitly declared that the template with match="ab:Worker_Record" is supposed to handle nodes in a streamed input document, but (a) it can't do that, because of the multiple downward selections, and (b) it doesn't need to, because you have "grounded" the node by calling copy-of. So the simplest solution is to change this template rule (and the apply-templates invocation) to use a different, non-streamable, mode.

The bug entry you cite is specific to xsl:call-template, which you are not using.

RE: Not able to use burst-mode streaming with saxon9.7.0.12 - Added by Michael Kay about 7 years ago

Some other stylistic comments on your code (I hope you don't mind the additional feedback):


  
   
    
  
  

You never need to apply number() to the result of count() as count already returns a number. And you can write count(X) > 0 as exists(X).

I suppose the xsl:value-of is probably just for illustration, but in a real stylesheet you could write @xsl:texttrue</xsl:text>@.

I would personally rewrite this as two template rules:


  true



RE: Not able to use burst-mode streaming with saxon9.7.0.12 - Added by Susan Chen about 7 years ago

Hi Michael, Thanks for the feedback. I really appreciate it!
One more question: The example given in burst-mode streaming made me believe once it's in burst-mode using copy-of(.) the code that process this "grounded" node does not need to be streamable and can use any XLST constructs. Does it sound like the code process this "grounded" node still needs to follow streamable rules?

RE: Not able to use burst-mode streaming with saxon9.7.0.12 - Added by Michael Kay about 7 years ago

You're right. That is to say, copy-of creates an ordinary in-memory tree and the code that processes the copy doesn't need to satisfy any streamability rules - which means it should go in a non-streamable mode so that Saxon does not apply the streamability rules.

    (1-4/4)

    Please register to reply