Subject: Re: [xsl] select="..." expressions in XSLT From: Jeni Tennison <jeni@xxxxxxxxxxxxxxxx> Date: Thu, 20 Dec 2001 17:03:39 +0000 |
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
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] select="..." expressions in X, Knebels, Francis | Thread | [xsl] XSLT 2.0 and XPath 2.0 Workin, Michael Kay |
RE: [xsl] Template problem.Unnecess, Tarun Saheja | Date | Re: [xsl] document() merge DISTINCT, Jeni Tennison |
Month |