Re: [xslt] math:max and node-sets



Markus Bayerlein said:
<snip>
>
> Nodes with a non-number value are explicitly excluded from the tree
> fragment:
>
>   <xsl:variable name="resNodes">
>     <xsl:for-each select="$nodes">
>       <xsl:if test="@val and string(number(@val)) != 'NaN'">
>         <dummynode>
>           <xsl:value-of select="@val"/>
>         </dummynode>
>       </xsl:if>
>     </xsl:for-each>
>   </xsl:variable>
>
> So $resNodes is rather
> <dummynode>300</dummynode>
> <dummynode>100</dummynode>
> <dummynode>200</dummynode>
> <dummynode>300</dummynode>
>
> and despite your lucid explanation I would expect a math:max value
> of
> 300.
>
> Markus

Yes, you are correct on this point.  I actually responded to your
previous post based only upon specifications, and didn't go into any
attempt at debugging the library routines.  I have now done that. I
have found, in fact, there are several problems.  Among other
things, the routines don't behave in the way the specs state (for
example, if you re-arrange your test xml file so that the maximum
number is not at the beginning of the list, you will find that the
call to math:max with the Result Tree Fragment still [incorrectly]
finds it); if you run xsltproc with your testfiles under the memory
checker Valgrind, you will find there are memory access errors going
on (this is the reason for the NaN result).  This might take me
awhile to find and fix - I will let you know of my progress.  My
apologies for missing your NaN test, but I assume you agree with my
other points.

Regards,

Bill



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]