Project

Profile

Help

xsl:for-each exception in Saxon 8.3

Added by Anonymous over 19 years ago

Legacy ID: #3073291 Legacy Poster: David Pirkle (dpirkle)

I have an xslt function that is returning a sequence. When I pass that sequence to an xsl:for-each, an ArrayIndexOutOfBoundsException is thrown. It looks like the code that is processing the for-each is going beyond the end of an array that is associated with sequence. Here some source that reproduces the problem: <?xml version="1.0"?> <xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:foobar="http://www.foobar.com" exclude-result-prefixes="foobar"> <xsl:template match='/'> <xsl:for-each select='foobar:test(1, 1, ())'> <xsl:value-of select='.'/><xsl:if test='position() lt last()'><br/></xsl:if> </xsl:for-each> </xsl:template> <xsl:function name='foobar:test'> <xsl:param name='index'/> <xsl:param name='numberOfItems'/> <xsl:param name='itemInfo'/> <xsl:variable name='nextItemInfo' select='if ($index &lt;= $numberOfItems) then ($itemInfo, "testing") else ()'/> <xsl:sequence select='if ($index lt $numberOfItems) then foobar:test($index + 1, $numberOfItems, $nextItemInfo) else $nextItemInfo'/> </xsl:function> </xsl:stylesheet>


Replies (1)

RE: xsl:for-each exception in Saxon 8.3 - Added by Anonymous over 19 years ago

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

Thanks for reporting this. I've reproduced it on Saxon 8.3, but the problem is fixed on my current build. This is in fact the same bug as https://sourceforge.net/tracker/index.php?func=detail&amp;aid=1151702&amp;group_id=29872&amp;atid=397617 though that isn't obvious from the description. It's quite difficult to characterize the source constructs that can generate the internal code that triggers this particular problem.

    (1-1/1)

    Please register to reply