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

Re: check the type of the $pattern argument to a regul

Subject: Re: check the type of the $pattern argument to a regular expression?
From: "bryan rasmussen" <rasmussen.bryan@xxxxxxxxx>
Date: Sat, 14 Apr 2007 14:22:44 +0200
Re:  check the type of the $pattern argument to a regul
Hi,

I think I was probably imprecise in my earlier post. matches and the
other regular expressions functions can raise errors (either static or
dynamic, from my reading of the spec) if the pattern parameter of the
function does not conform to the syntactical rules for Regular
Expressions. This is basically a typing problem. Other common typing
problems in XSLT 2 are solved by using castable, but regular
expression patterns are not castable the way dates or integers are
(also by reading of spec, but it seems pretty clear cut they wouldn't
be), thus I cannot check if a regular expression pattern actually
conforms to syntactical expectations before performing the check.

I was wondering if anyone had any suggestions around this problem, or
if my reading of the problem was incorrect (which it certainly may be)

Cheers,
Bryan Rasmussen

On 4/14/07, Philip Vallone <philip.vallone@xxxxxxxxxxx> wrote:
Hi Bryan,

I use the mactches function:

matches(string,pattern)

For example the following checks for a two digit pattern.

<xsl:if test="matches($input,'\d{2}')>
....do somthing
</xsl:if>

Regards,

Phil


-----Original Message----- From: bryan rasmussen [mailto:rasmussen.bryan@xxxxxxxxx] Sent: Friday, April 13, 2007 9:39 PM To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx Subject: check the type of the $pattern argument to a regular expression?

Hi,

I would like to check the that the $pattern argument to a regular
expression in fact follows regular expression rules, since regex is
not castable I guess the only way to do this would be to use regular
expressions and perhaps a for-each to check that the $pattern argument
conforms?

Cheers,
Bryan Rasmussen

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.