Reputation: 2277
With this line I can print out values that are bigger than 1999
<xsl:for-each select="//ad[regyear >= 1999]" >
But I cant seem to find out how to print out values from 1998 and down.
Upvotes: 1
Views: 73
Reputation: 243519
For readability I recommend not to use <
.
Instead of:
//ad[regyear <= 1998]
I use:
//ad[not(regyear > 1998)]
Never escape the >
char in an XPath expression -- I am not aware of a case when this is necessary.
Finally, as Lars correctly mentions, in XPath 2.0 (XSLT 2.0) use the lt
, gt
, le
, ge
and ne
value comparison operators and don't use the general comparison operators for comparisons between two values.
Upvotes: 1
Reputation: 27994
@Kirill gave the main answer, but in XSLT 2.0 you can also use lt
or le
:
//ad[regyear lt 1999]
which may be more readable. In some cases, existential comparison operators like <
can have unexpected hairy implications, and lt
avoids those.
Upvotes: 2
Reputation: 56182
Bigger or equals to 1999
:
//ad[regyear >= 1999]
Smaller or equals to 1998
:
//ad[regyear <= 1998]
Upvotes: 2