Regex for only positive values?

Correct. XPath expression evaluation will dynamically type-cast operator arguments (and often XPath function arguments too) as needed. It doesnt actually know what the associated XForm binding type might happen to be (!), so it's all based off the XPath expression itself.

That said, personally, especially when it comes to dates, I still prefer to uses things like number() and decimal-date-time() to explicitly indicate the conversion taking place.

[oh, but this type-casting magic isnt smart enough to know to convert "two" to 2, so as @ahblake suggests, if you are really wanting the user to enter a number then I'd agree you should probably make the question integer or decimal, not text].

2 Likes