#66 for-each loops through empty collection

v1.0_(example)
open
nobody
1
2014-02-18
2014-02-04
Anonymous
No

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>

Related

Support Requests: #66

Discussion

  • oneil
    oneil
    2014-02-04

    Hi,

    Thanks for contacting us in regards to the error you have hit.

    Regardless of the not executing the for-loop the DateTime 'T12:00:00Z'
    is not correct. You are missing the actual date part that is why it is
    failing. E.g. 2014-02-01T12:00:00Z

    I recommend using a developer site to report potential bugs:

    https://saxonica.plan.io/projects/saxon

    And forums:

    https://saxonica.plan.io/projects/saxon/boards

    On 04/02/2014 11:30, Ticket 66 wrote:


    [support-requests:#66]
    http://sourceforge.net/p/saxon/support-requests/66/ for-each loops
    through empty collection

    Status: open
    Labels: for-each; loop; sequence; inner statement;
    Created: Tue Feb 04, 2014 11:30 AM UTC by Anonymous
    Last Updated: Tue Feb 04, 2014 11:30 AM UTC
    Owner: nobody

    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>


    Sent from sourceforge.net because you indicated interest in
    https://sourceforge.net/p/saxon/support-requests/66/

    To unsubscribe from further messages, please visit
    https://sourceforge.net/auth/subscriptions/

    No virus found in this message.
    Checked by AVG - www.avg.com http://www.avg.com
    Version: 2014.0.4259 / Virus Database: 3684/7058 - Release Date: 02/03/14

     

    Related

    Support Requests: #66

    Attachments
    • oneil
      oneil
      2014-02-04

      Hi,

      My apologies you are correct the code in the for loop should not be
      evaluated. The problem is the xsl:sequence in the loop is being pulled
      out into a variable since it is not dependent on the for-loop. The
      policy should be to do lazy evaluation of the variable to where it is
      called in the loop, but this is not happening. We will investigate this
      further and let you know.

      Kind regards,

      O'Neil

      On 04/02/2014 14:51, oneil wrote:

      Hi,

      Thanks for contacting us in regards to the error you have hit.

      Regardless of the not executing the for-loop the DateTime 'T12:00:00Z'
      is not correct. You are missing the actual date part that is why it is
      failing. E.g. 2014-02-01T12:00:00Z

      I recommend using a developer site to report potential bugs:

      https://saxonica.plan.io/projects/saxon

      And forums:

      https://saxonica.plan.io/projects/saxon/boards

      On 04/02/2014 11:30, Ticket 66 wrote:

      ------------------------------------------------------------------------
      
      /[support-requests:#66]
      <http://sourceforge.net/p/saxon/support-requests/66/>
      http://sourceforge.net/p/saxon/support-requests/66/ for-each loops
      through empty collection/
      
      /Status:/ open
      /Labels:/ for-each; loop; sequence; inner statement;
      /Created:/ Tue Feb 04, 2014 11:30 AM UTC by Anonymous
      /Last Updated:/ Tue Feb 04, 2014 11:30 AM UTC
      /Owner:/ nobody
      
      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>
      
      ------------------------------------------------------------------------
      
      Sent from sourceforge.net because you indicated interest in
      https://sourceforge.net/p/saxon/support-requests/66/
      
      To unsubscribe from further messages, please visit
      https://sourceforge.net/auth/subscriptions/
      
      No virus found in this message.
      Checked by AVG - www.avg.com http://www.avg.com
      Version: 2014.0.4259 / Virus Database: 3684/7058 - Release Date:
      02/03/14
      

      [support-requests:#66]
      http://sourceforge.net/p/saxon/support-requests/66/ for-each loops
      through empty collection

      Status: open
      Labels: for-each; loop; sequence; inner statement;
      Created: Tue Feb 04, 2014 11:30 AM UTC by Anonymous
      Last Updated: Tue Feb 04, 2014 11:30 AM UTC
      Owner: nobody

      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>


      Sent from sourceforge.net because you indicated interest in
      https://sourceforge.net/p/saxon/support-requests/66/

      To unsubscribe from further messages, please visit
      https://sourceforge.net/auth/subscriptions/

      No virus found in this message.
      Checked by AVG - www.avg.com http://www.avg.com
      Version: 2014.0.4259 / Virus Database: 3684/7058 - Release Date: 02/03/14

       

      Related

      Support Requests: #66

      Attachments
      • oneil
        oneil
        2014-02-04

        The bug has been reported and fixed. See the bug entry at

        https://saxonica.plan.io/issues/1997

        On 04/02/2014 15:09, oneil wrote:

        Hi,

        My apologies you are correct the code in the for loop should not be
        evaluated. The problem is the xsl:sequence in the loop is being pulled
        out into a variable since it is not dependent on the for-loop. The
        policy should be to do lazy evaluation of the variable to where it is
        called in the loop, but this is not happening. We will investigate this
        further and let you know.

        Kind regards,

        O'Neil

        On 04/02/2014 14:51, oneil wrote:

        Hi,
        
        Thanks for contacting us in regards to the error you have hit.
        
        Regardless of the not executing the for-loop the DateTime 'T12:00:00Z'
        is not correct. You are missing the actual date part that is why it is
        failing. E.g. 2014-02-01T12:00:00Z
        
        I recommend using a developer site to report potential bugs:
        
        https://saxonica.plan.io/projects/saxon
        
        And forums:
        
        https://saxonica.plan.io/projects/saxon/boards
        
        On 04/02/2014 11:30, Ticket 66 wrote:
        
        ------------------------------------------------------------------------
        
        /[support-requests:#66]
        <http://sourceforge.net/p/saxon/support-requests/66/>
        http://sourceforge.net/p/saxon/support-requests/66/ for-each loops
        through empty collection/
        
        /Status:/ open
        /Labels:/ for-each; loop; sequence; inner statement;
        /Created:/ Tue Feb 04, 2014 11:30 AM UTC by Anonymous
        /Last Updated:/ Tue Feb 04, 2014 11:30 AM UTC
        /Owner:/ nobody
        
        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>
        
        ------------------------------------------------------------------------
        
        Sent from sourceforge.net because you indicated interest in
        https://sourceforge.net/p/saxon/support-requests/66/
        
        To unsubscribe from further messages, please visit
        https://sourceforge.net/auth/subscriptions/
        
        No virus found in this message.
        Checked by AVG - www.avg.com http://www.avg.com
        Version: 2014.0.4259 / Virus Database: 3684/7058 - Release Date:
        02/03/14
        
        ------------------------------------------------------------------------
        
        /[support-requests:#66]
        <http://sourceforge.net/p/saxon/support-requests/66/>
        http://sourceforge.net/p/saxon/support-requests/66/ for-each loops
        through empty collection/
        
        /Status:/ open
        /Labels:/ for-each; loop; sequence; inner statement;
        /Created:/ Tue Feb 04, 2014 11:30 AM UTC by Anonymous
        /Last Updated:/ Tue Feb 04, 2014 11:30 AM UTC
        /Owner:/ nobody
        
        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>
        
        ------------------------------------------------------------------------
        
        Sent from sourceforge.net because you indicated interest in
        https://sourceforge.net/p/saxon/support-requests/66/
        
        To unsubscribe from further messages, please visit
        https://sourceforge.net/auth/subscriptions/
        
        No virus found in this message.
        Checked by AVG - www.avg.com http://www.avg.com
        Version: 2014.0.4259 / Virus Database: 3684/7058 - Release Date:
        02/03/14
        

        [support-requests:#66]
        http://sourceforge.net/p/saxon/support-requests/66/ for-each loops
        through empty collection

        Status: open
        Labels: for-each; loop; sequence; inner statement;
        Created: Tue Feb 04, 2014 11:30 AM UTC by Anonymous
        Last Updated: Tue Feb 04, 2014 11:30 AM UTC
        Owner: nobody

        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>


        Sent from sourceforge.net because you indicated interest in
        https://sourceforge.net/p/saxon/support-requests/66/

        To unsubscribe from further messages, please visit
        https://sourceforge.net/auth/subscriptions/

        No virus found in this message.
        Checked by AVG - www.avg.com http://www.avg.com
        Version: 2014.0.4259 / Virus Database: 3684/7058 - Release Date: 02/03/14

         

        Related

        Support Requests: #66

        Attachments

  • Anonymous
    2014-02-05

    Hi oneil,

    Thanks for fixing this bug so rapidly.
    We will use an ugly workaround till the fix is released.

    Can't stop saying it's great you fixed it this quick.

    Thanks a million,
    Wesley

     


Anonymous


Cancel   Add attachments