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

Xpath patern question

Subject: Xpath patern question
From: Hélder Sousa <Helder.Sousa@xxxxxx>
Date: Mon, 10 Mar 2003 16:16:08 -0000
patern
Hi!

I have the follow xml example:
<?xml version="1.0" encoding="UTF-8"?>
<xxx>
	<yyyy>
		<campo>12-12-2002</campo>
		<campo>2</campo>
	</yyyy>
	<zzz>
		<campo>1</campo>
		<campo>2</campo>
	</zzz>
</xxx>

Imagine that I want all elements "campo" with value matching a determinate patern. For example, I want all elements "campo" whose value is like "2 digits, a separator("/" or "-"), 2 digits, a separator("/" or "-"), 4 digits". This is a date! 
I'm doing that using javascript in xsl
<xsl:script>
	<![CDATA[
	function VerifyDate( node ){
	   var node_Value = node.selectSingleNode(".");
	   var value = new String( node_Value.text );
	   var encont = value.match(/(\d{1,2})[-|\/](\d{1,2})[-||\/](\d{4})/);
	   if ( encont != null )
	     return true;
	   else
	     return false;
	}
	]]>
</xsl:script>

My question is: "This is possible to do with xpath, without using the script?" Tks for helpe.




Hélder Sousa
Departamento de  Projectos e-Business 
I2S - Informática Sistemas e Serviços 
<<mailto:helder.sousa@xxxxxx>> - <<http://www.i2s.pt/>>
Tel.: +351 22 834 04 00; Fax: +351 22 834 07 95 
Portugal 

 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.