xsl-list
[Top] [All Lists]

Re: [xsl] Fundimentle Predicate Problem or Bug??

2008-09-17 10:07:53
Chris Hughes wrote:

<ORCB082>
   <ROWSET>
      <ROW num="1">
        <Fixture>
            <FixtureDate>2008-10-17</FixtureDate>
            <FixtureDayText>DAY ONE TEST</FixtureDayText>
            <Race>
               <RaceType>S</RaceType>
            </Race>
            <Race>
               <RaceType>H</RaceType>
            </Race>
         </Fixture>
      </ROW>
   </ROWSET>
</ORCB082>


Stylesheet 1
------------

This stylesheet outputs "DAY ONE TEST" message, IMO it should match no records 
and not output anything.

<?xml version="1.0"?> <xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
                                xmlns:xs="http://www.w3.org/2001/XMLSchema";>
<xsl:output method="text" indent="yes"/>
  <xsl:template match="/">

  <xsl:for-each select="/ORCB082/ROWSET/ROW/Fixture[FixtureDate &gt;= '2008-01-01' 
and FixtureDate &lt;= '2010-01-01' and
                                                    Race/RaceType &gt;= 'R' and 
Race/RaceType &lt;= 'R']" >

Race/RaceType >= 'R' is true for the <RaceType>S</RaceType> element, Race/RaceType <= 'R' is true for the <RaceType>H</RaceType>.

So the result you see is a consequence of >= or <= applied to node-set operands (in XPath 1.0) or sequence operands (in XPath 2.0) being true if there is at least one item in each operand node-set/sequence for which the comparison is true.


--

        Martin Honnen
        http://JavaScript.FAQTs.com/

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--