Subject: RE: [xsl] Challenge: create xPath 2.0 regular expressions for each XML Schema datatype From: "Michael Kay" <mike@xxxxxxxxxxxx> Date: Wed, 18 Oct 2006 23:04:55 +0100 |
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@xxxxxxxxx] > Sent: 18 October 2006 12:27 > To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx > 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
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Challenge: create xPath 2, Abel Braaksma | Thread | [xsl] FW: 2 XML Files, 1 XSLt Outpu, McDonald, Shaun |
RE: [xsl] a simple RTF <> XML quest, Nilsson, David F | Date | Re: [xsl] embedded javascript in ge, Abel Braaksma |
Month |