[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: select="..." expressions in XSLT

Subject: Re: select="..." expressions in XSLT
From: Jeni Tennison <jeni@xxxxxxxxxxxxxxxx>
Date: Thu, 20 Dec 2001 17:03:39 +0000
xslt distinct jeni
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
> &lt;=20011220&lt;=@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

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.