This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: xsl Filter Question


> This filter works fine :
> <xsl:for-each  select="report/row[col='some value']">
> 
> But how do filters for >, < in case of text, number and date data ?
> 
> I tried this
> <xsl:for-each  select="report/row[col>'some value']">
> But it did not work.
> 

XPath 1.0 offers "<" and ">" only for numeric values. For other data
types you need to wait till XPath 2.0, or use a workaround.

For dates in iso format, you can strip the punctuation using
translate(), so that 2002-07-23 becomes 20020723, then you can compare
dates as numbers.

For comparing strings alphabetically, the best solution is probably an
extension function, though you can probably do it in XSLT (exploiting
xsl:sort) if you're determined enough.

Michael Kay
Software AG
home: Michael.H.Kay@ntlworld.com
work: Michael.Kay@softwareag.com 


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]