[Xsltforms-support] bind type and NCName in xsltforms r295
Brought to you by:
alain-couthures
From: Klotz, L. <Lei...@xe...> - 2009-12-23 00:10:42
|
In XSLTForms if I use <xf:bind nodeset="foo" type="anyURI" /> I get a popup error that says "Schema undefined not defined." I believe there are two possible things to fix here: 1. The error message could be better. 2. XForms says that NCNames are considered to be in the XForms namespace, which means for anyURI that it's the xforms:anyURI type (union of empty string and xsd:anyURI). Here are some possible fixes. Other fixes may be better, for example changing Schena.prototype.getType, but this is what I found. Possible fix for #1: Schema.getTypeNS = function(ns, name) { var schema = Schema.all[ns]; if (!schema) { alert("Schema for namespace " + ns + " not defined; type " + type); throw "Error"; } var type = schema.types[name]; if (!type) { alert("Type " + name + " not defined in namespace " + namespace); throw "Error"; } return type; }; Possible fix for #2: Schema.getType = function(name) { var res = name.split(":"); if (typeof(res[1]) == "undefined") { return Schema.getTypeNS(Schema.prefixes["xforms"], res[0]); } else { return Schema.getTypeNS(Schema.prefixes[res[0]], res[1]); } }; This supposes that the xforms:anyURI type is properly implemented, which is a separate issue I didn't explore. Leigh. |