Subject: [xsl] Fundimentle Predicate Problem or Bug?? From: Chris Hughes <chris_hughes22@xxxxxxxxxxx> Date: Wed, 17 Sep 2008 13:52:31 +0000 (GMT) |
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
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Distinct values with XPat, Matthew Hailstone | Thread | Re: [xsl] Fundimentle Predicate Pro, Ronan Klyne |
Re: [xsl] Tag movement in XML, Ganesh Babu N | Date | Re: [xsl] Fwd: text nodes, Sam Byland |
Month |