Hi,
after some trying in vain to implement a constraint using the XPath Function fn:matches and a numneric quantifier: constraint="matches(.,'^[1-9][0-9]{3}-[0-1][0-9]-[0-3][0-9]$')" to ensure that the field contains only a date with format YYYY-MM-DD, i found that the curly brackets of the quantifier cause trouble if the XForms view is a XSLT template. They seem to "get lost" during the Transformation(?). To "protect" the brackets, they have to be duplicated: constraint="matches(.,'^[1-9][0-9]{{3}}-[0-1][0-9]-[0-3][0-9]$')" the syntax first metioned works only in static (X)HTML Views. Is there a way to except the regex from getting changed during transformation? florian PS: I know i could bind xs:date as type to use the calendar control, but my users prefer to enter the date "by hand" or using c&p - it's faster PPS: I know that the RegEx doesn't ensure in every case that the data is a valid date... 2007-19-39 as well as 2000-00-00 are accepted, too :-) -- You receive this message as a subscriber of the [hidden email] mailing list. To unsubscribe: mailto:[hidden email] For general help: mailto:[hidden email]?subject=help ObjectWeb mailing lists service home page: http://www.objectweb.org/wws |
Florian,
Your problem rung a bell so I searched the archives and found that indeed I too encountered the same problem: http://www.objectweb.org/wws/arc/ops-users/2005-12/msg00231.html I also spent some quality time with this back then and ended up not with a less elegant workaround - I just n-plicated the [0-9] pattern. :-) A. On Jul 17, 2007, at 1:42 PM, Florian Schmitt wrote: > Hi, > > after some trying in vain to implement a constraint using the XPath > Function fn:matches and a numneric quantifier: > > constraint="matches(.,'^[1-9][0-9]{3}-[0-1][0-9]-[0-3][0-9]$')" > > to ensure that the field contains only a date with format YYYY-MM- > DD, i found that the curly brackets of the quantifier cause trouble > if the > XForms view is a XSLT template. They seem to "get lost" during the > Transformation(?). To "protect" the brackets, they have to be > duplicated: > > constraint="matches(.,'^[1-9][0-9]{{3}}-[0-1][0-9]-[0-3][0-9]$')" > > the syntax first metioned works only in static (X)HTML Views. Is > there a way to except the regex from getting changed during > transformation? > > > florian > > PS: I know i could bind xs:date as type to use the calendar > control, but my users prefer to enter the date "by hand" or using > c&p - it's faster > > PPS: I know that the RegEx doesn't ensure in every case that the > data is a valid date... 2007-19-39 as well as 2000-00-00 are > accepted, too :-) > > > > > > -- > You receive this message as a subscriber of the ops- > [hidden email] mailing list. > To unsubscribe: mailto:[hidden email] > For general help: mailto:[hidden email]?subject=help > ObjectWeb mailing lists service home page: http://www.objectweb.org/ > wws -- You receive this message as a subscriber of the [hidden email] mailing list. To unsubscribe: mailto:[hidden email] For general help: mailto:[hidden email]?subject=help ObjectWeb mailing lists service home page: http://www.objectweb.org/wws |
Administrator
|
In reply to this post by fl.schmitt(ops-users)
Florian Schmitt wrote:
> Hi, > > after some trying in vain to implement a constraint using the XPath > Function fn:matches and a numneric quantifier: > > constraint="matches(.,'^[1-9][0-9]{3}-[0-1][0-9]-[0-3][0-9]$')" > > to ensure that the field contains only a date with format YYYY-MM-DD, i > found that the curly brackets of the quantifier cause trouble if the > XForms view is a XSLT template. They seem to "get lost" during the > Transformation(?). To "protect" the brackets, they have to be duplicated: > > constraint="matches(.,'^[1-9][0-9]{{3}}-[0-1][0-9]-[0-3][0-9]$')" > > the syntax first metioned works only in static (X)HTML Views. Is there a > way to except the regex from getting changed during transformation? attribute value template (AVT), and (it seems) without an option to disable them: http://www.w3.org/TR/xslt20/#attribute-value-templates This is why your brackets are apparently "eaten". As you figured out, you either have to not use XSLT, or escape these brackets. -Erik -- Orbeon Forms - Web Forms for the Enterprise Done the Right Way http://www.orbeon.com/ -- You receive this message as a subscriber of the [hidden email] mailing list. To unsubscribe: mailto:[hidden email] For general help: mailto:[hidden email]?subject=help ObjectWeb mailing lists service home page: http://www.objectweb.org/wws |
Hi Erik and Alexander,
> XSLT will process every literal attribute in the stylesheet as an > attribute value template (AVT), and (it seems) without an option to > disable them: > > http://www.w3.org/TR/xslt20/#attribute-value-templates > > This is why your brackets are apparently "eaten". > > As you figured out, you either have to not use XSLT, or escape these > brackets. The Workaround to multiply the RegEx seems to be a viable solution in that case! florian -- You receive this message as a subscriber of the [hidden email] mailing list. To unsubscribe: mailto:[hidden email] For general help: mailto:[hidden email]?subject=help ObjectWeb mailing lists service home page: http://www.objectweb.org/wws |
Free forum by Nabble | Edit this page |