[XSL-LIST Mailing List Archive Home]
[By Thread]
[By Date]
Re: [xsl] Fundimentle Predicate Problem or Bug??
Subject: Re: [xsl] Fundimentle Predicate Problem or Bug?? From: Ronan Klyne <ronan.klyne@xxxxxxxxxxx> Date: Wed, 17 Sep 2008 15:03:07 +0100 |
Chris Hughes wrote: > Hi > > I tried asking for help a while back on this, anyway now I have worked out exactly where my issue is and will provide examples below. > > Assume this data.... > > <?xml version="1.0" encoding="utf-8"?> > <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 >= '2008-01-01' and FixtureDate <= '2010-01-01' and > Race/RaceType >= 'R' and Race/RaceType <= 'R']" > > > <xsl:message><xsl:value-of select="FixtureDayText"/></xsl:message> > </xsl:for-each> > </xsl:template> > </xsl:stylesheet> > > > Stylesheet 2 > ------------ > > This stylesheet outputs nothing - which is what I would expect, but essentially is stylesheet 1 not performing the same logic as 2? > > > <?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 >= '2008-01-01' and FixtureDate <= '2010-01-01' and > Race/RaceType = 'R']" > > > <xsl:message><xsl:value-of select="FixtureDayText"/></xsl:message> > </xsl:for-each> > </xsl:template> > </xsl:stylesheet> > > Conclusion > ----------- > > Like so many of us working in the XML / XSLT world I find it difficult to adjust to a different way of working. Essentially had I wrote this logic in SQL or 4GL or VB etc etc I'd be sure that it would work. I hope nobody is offended by me suggesting this may be a bug! > > Thanks in advance. > > Chris > In your first solution, Race/Racetype is a set of two values, 'S', and 'H'. The tricky bit is in how your tests apply to sets. When the right hand side is a set, the tests "'R' <= ...." and "'R' >= ...." both return true if 'R' is <= _any_ element of the set or >= _any_ element of the set. The first test matches 'S' and the second test matches 'H' # r -- Ronan Klyne Business Collaborator Developer Tel: +44 01189 028518 ronan.klyne@xxxxxxxxxxx www.groupbc.com
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] Fundimentle Predicate Problem, Chris Hughes | Thread | Re: [xsl] Fundimentle Predicate Pro, David Carlisle |
Re: [xsl] Fwd: text nodes, Sam Byland | Date | Re: [xsl] Fundimentle Predicate Pro, David Carlisle |
Month |