[Xsltforms-support] is external shema validation of input working?
Brought to you by:
alain-couthures
From: Stephen C. <Ste...@ut...> - 2010-04-17 03:53:26
|
Hello, I'm looking at test-case "3.3.1.c1 valid schema" but XSLTForms does not seem to actually apply any validation specified in the schema for the element '<ex:myYear>', even though if finds and parses the schema. Here is my copy of 3.3.1.c1, should not this indicate that a non-integer input (year) value is invalid? 1. XForm <?xml-stylesheet href="build/xsltforms.xsl" type="text/xsl"?> <html xmlns:my="http://commerce.example.com/payment" xmlns:txs="http://sourceforge.net/projects/txs" xmlns="http://www.w3.org/1999/xhtml" xmlns:req="http://www.agencexml.com/requests" xmlns:xforms="http://www.w3.org/2002/xforms" xmlns:ex="http://www.example.com" xmlns:ev="http://www.w3.org/2001/xml-events" xmlns:xhtml="http://www.w3.org/1999/xhtml"> <head> <title>3.3.1.c1 valid schema</title> <xforms:model id="m_001" schema="schema.xsd"> <xforms:instance> <data xmlns=""> <ex:myYear>2001</ex:myYear> </data> </xforms:instance> <xforms:bind id="year" nodeset="ex:myYear" incremental="true()"/> <xforms:message ev:event="xforms-link-exception" level="modal">xforms-link-exception</xforms:message> </xforms:model> </head> <body> <xforms:input bind="year"> <xforms:label>Year:</xforms:label> </xforms:input> </body> </html> 2 XML Schema (schema.xsd) <?xml version="1.0" encoding="UTF-8"?> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="http://www.example.com"> <xs:element name="myYear"> <xs:simpleType> <xs:restriction base="xs:integer"/> </xs:simpleType> </xs:element> </xs:schema> I'd appreciate it if someone could help get me started with this, I actually want to apply a regular expression to a string via a restriction. This example should work (from xforms essentials http://xformsinstitute.com/essentials/browse/ch04s04.php) . <xs:simpleType name="email"> <xs:restriction base="xs:string"> <xs:pattern value="[A-Za-z0-9!#-'\*\+\-/=\?\^_`\{-~]+ (\.[A-Za-z0-9!#-'\*\+\-/=\?\^_`\{-~]+)*@[A-Za-z0-9!#- '\*\+\-/=\?\^_`\{-~]+(\.[A-Za-z0-9!#-'\*\+\-/=\?\^_`\ {-~]+)*"/> </xs:restriction> </xs:simpleType> -- Regards Stephen Cameron Data Programmer Integrated Marine Observing System (IMOS) eMarine Information Infrastructure Project University of Tasmania, Private Bag 21, Hobart, TAS 7001, Australia Tel: +61 3 6226 8507 Fax: +61 3 6226 2997 Email: ste...@ut... URL: http://www.imos.org.au/eMII.html |