Actions
Bug #1997
closedfor-each loops through empty collection
Start date:
2014-02-04
Due date:
% Done:
100%
Estimated time:
Legacy ID:
Applies to branch:
Fix Committed on Branch:
Fixed in Maintenance Release:
Platforms:
Description
Bug reported by user at http://sourceforge.net/p/saxon/support-requests/66/
In the following example the output of $var564_resultof_filter[fn:exists($var565_cur/NonExistingElement)] is empty.
Therefore there is nothing to loop through. Although Saxon is evaluating the inner statement which fails on xs:dateTime function. $var565_cur/NonExistingElement is not available and fn:string will return an empty string.
The underneath exception: Invalid dateTime value "T12:00:00Z" (Non-numeric year component) is thrown.
Saxon (9.4.0.7) is evaluating code in a loop that not meant to be hit because there are no items in the collection.
<xsl:for-each select="$var564_resultof_filter[fn:exists($var565_cur/NonExistingElement)]">
<ElementToGenerateForEachItemInLoop>
<xsl:sequence select="xs:string(xs:dateTime(fn:concat(fn:string($var565_cur/NonExistingElement), 'T12:00:00Z')))"/>
</ElementToGenerateForEachItemInLoop>
</xsl:for-each>
Please register to edit this issue
Actions