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

Re: Xpath patern question

Subject: Re: Xpath patern question
From: Jeni Tennison <jeni@xxxxxxxxxxxxxxxx>
Date: Mon, 10 Mar 2003 18:09:16 +0000
xpath substring
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

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.