[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Xpath patern question
Hi Hélder, > I had think about that solution but my date can be like "1/1/2003" > and I can't change it to " 1/ 1/2003".. So that doesn't work. You asked for: >> I want all elements "campo" whose value is like "2 digits, a >> separator("/" or "-"), 2 digits, a separator("/" or "-"), 4 >> digits". Your example "1/1/2003" does not match this pattern. To match dates in that format as well, try: campo[(contains(., '/') and number(substring-before(., '/')) and string-length(substring-before(., '/')) <= 2 and number(substring-before(substring-after(., '/'))) and string-length(substring-before(substring-after(., '/'))) <= 2 and number(substring-after(substring-after(., '/'))) and string-length(substring-after(substring-after(., '/'))) = 4) or (contains(., '-') and number(substring-before(., '-')) and string-length(substring-before(., '-')) <= 2 and number(substring-before(substring-after(., '-'))) and string-length(substring-before(substring-after(., '-'))) <= 2 and number(substring-after(substring-after(., '-'))) and string-length(substring-after(substring-after(., '-'))) = 4)] Of course none of this tests that the date actually makes sense... Cheers, 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
|