Subject: Re: [xsl] 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 |
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
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: [xsl] 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 |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] check the type of the $pa, Philip Vallone | Thread | RE: [xsl] check the type of the $pa, Michael Kay |
RE: [xsl] check the type of the $pa, Philip Vallone | Date | RE: [xsl] Xsl:param from PHP to htm, Alan Hale |
Month |