|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: select="..." expressions in XSLT
Hi Francis,
> I'm trying to get this XSL to work, but it is not giving me the output I'm
> looking for. The XSL looks like this:
>
> <?xml version="1.0"?>
> <xsl:stylesheet version="1.0"
> xmlns:xsl="http://www.w3.org/1999/XSL/Transform"><xsl:template
> match="/"><xsl:copy-of select="/campaign/question[@start-date
> <=20011220<=@end-date]"/>
> </xsl:template>
> </xsl:stylesheet>
The XPath test:
@start-date <= 20011220 <= @end-date
Is parsed as if it were:
(@start-date <= 20011220) <= @end-date
So if @start-date <= 20011220, then it's:
true() <= @end-date
Which is why it doesn't work.
Basically, you can't do two comparisons back to back in that way. You
have to use 'and' to join the two tests.
@start-date <= 20011220 and 20011220 <= @end-date
or (if you want to avoid escaping less-than signs):
20011220 >= @start-date and @end-date >= 20011220
So try:
<xsl:copy-of select="/campaign/question[20011220 >= @start-date and
@end-date >= 20011220]" />
I hope that helps,
Jeni
---
Jeni Tennison
http://www.jenitennison.com/
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








