It's a little paradoxical that we've just had a thread encouraging us to use
expression-based languages such as Schematron instead of grammar-based
languages for document structure validation, and now we see a thread
encouraging us to use grammar-based languages (regular expressions) instead
of expression-based languages for validating the content of text fields.
The fact is, both approaches have their place. It's as silly to use regular
expressions to check that a value is between 1 and 100 as it is to use path
expressions to check that an invoice contains a billing address, a delivery
address and a set of order lines, in that order.
Michael Kay
http://www.saxonica.com/
-----Original Message-----
From: Costello, Roger L. [mailto:costello(_at_)mitre(_dot_)org]
Sent: 18 October 2006 12:27
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: [xsl] Challenge: create xPath 2.0 regular
expressions for each XML Schema datatype
Hi Folks,
I would like to submit a challenge:
Create xPath 2.0 regular expressions for each of the XML
Schema datatypes.
Examples:
- the xPath expression which corresponds to integer is:
^\s*[+-]?\d+\s*$
- the xPath expression which corresponds to float is:
^\s*[+-]?\d+([eE]+?\d+)?\s*$
Datatype xPath 2.0 Regular Expression
-------------------------------------------------------------
anyURI
-------------------------------------------------------------
byte
-------------------------------------------------------------
decimal
-------------------------------------------------------------
ENTITY
-------------------------------------------------------------
ENTITIES
-------------------------------------------------------------
float ^\s*[+-]?\d+([eE]+?\d+)?\s*$
-------------------------------------------------------------
ID
-------------------------------------------------------------
IDREFS
-------------------------------------------------------------
int
-------------------------------------------------------------
integer ^\s*[+-]?\d+\s*$
-------------------------------------------------------------
language
-------------------------------------------------------------
long
-------------------------------------------------------------
Name
-------------------------------------------------------------
NCName
-------------------------------------------------------------
negativeInteger
-------------------------------------------------------------
NMTOKEN
-------------------------------------------------------------
NMTOKENS
-------------------------------------------------------------
nonNegativeInteger
-------------------------------------------------------------
nonPositiveInteger
-------------------------------------------------------------
normalizedString
-------------------------------------------------------------
NOTATION
-------------------------------------------------------------
QName
-------------------------------------------------------------
positiveInteger
-------------------------------------------------------------
short
-------------------------------------------------------------
string
-------------------------------------------------------------
token
-------------------------------------------------------------
unsignedByte
-------------------------------------------------------------
unsignedInt
-------------------------------------------------------------
unsignedInteger
-------------------------------------------------------------
unsignedLong
-------------------------------------------------------------
unsignedShort
-------------------------------------------------------------
Anyone up for the challenge?
/Roger
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail:
<mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--