|
Subject: Re: [xsl] Xpath patern question From: Jeni Tennison <jeni@xxxxxxxxxxxxxxxx> Date: Mon, 10 Mar 2003 18:09:16 +0000 |
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
| Current Thread |
|---|
|
| <- Previous | Index | Next -> |
|---|---|---|
| RE: [xsl] Xpath patern question, Hélder Sousa | Thread | RE: [xsl] Xpath patern question, Américo Albuquerque |
| Re: [xsl] xsl:variable, Mike Brown | Date | RE: [xsl] Xpath patern question, Américo Albuquerque |
| Month |