Re: XForms 2.0 schema [functions and variables]

This change adds functions and variables.

There are some outstanding issues that need resolution by the WG.
1. The draft describes the @src and its behavior but does not use the 
same warnings as elsewhere that the host language must add @src.
     The RNC schema uses xforms.linking.attributes, which is currently 
empty, and the host-language integration adds @src.

2. The draft has function/@charset to be used in the @src case.
     I recommend dropping this attribute and folding it into @type,  as 
in "application/javascript;charset=UTF-8".
     The changes below follow the current WD, with a content model for 
@type that does not permit ";charset=*"
     (Well, at least there are two content model names listed; both are 
just 'text' and not a complicated regex, for now.)

3. function says it has either sequence* or script*.
     What is the point of more than one sequence child of function if 
the expressions are free of side effects?  (I guess errors are side 
effects.)
     If scripts are side effect free as well, what is the point of more 
than one script?
     Also, why not allow both sequence and script and use the sequence 
of hte script fails to be recognized.  I thought that was discussed.
     All of these changes are easily done once the decision is made.

4. I could not find where in the spec variables are allowed.
     The best thing would be if you can find some existing content 
marker where they can be added, such as before a label.
     Are you considering allowing them scattered through form controls, 
or only at the top?
     Ditto for actions, though I can see scattered is better there.
     So in the RNC below, they are allowed only inside function because 
that's all I could find stated clearly.

5. I didn't see any AVT exclusions on the attributes on function, 
script, sequence, or var.
     For example, as written, var/@model is an AVT, becuase other models 
are AVT.  Is that what you want?
     I made no other attribute values AVT for function or var or their 
child elements, but a decision needs to be made.



Attached is an updated file for 
http://www.w3.org/MarkUp/Forms/wiki/XForms-nons-20.rnc
containing this change, plus the one outstanding previous change (to 
xforms.model.content).

Change

to

xforms.model.content =
   (xforms.instance
   | xforms.schema
   | xforms.submission
   | xforms.bind
   | xforms.Actions
   | xforms.Extension)*

to

xforms.model.content =
   (xforms.instance
   | xforms.schema
   | xforms.submission
   | xforms.bind
   | xforms.Actions
   | xforms.function
   | xforms.Extension)*

Just before the "# Form Controls" section add this section:

# Variables
xforms.var = element var { xforms.var.attrib, xforms.var.content }
xforms.var.attrib =
    xforms.Common.attrib,
    attribute name { xsd:QName },
    attribute value { XPathExpression },
    attribute model { IDREF-avt }?
xforms.var.content = text
# Functions
xforms.function = element function { xforms.function.attrib, 
xforms.function.content }
xforms.function.attrib =
    attribute signature { CustomFunctionSignature },
    attribute override { "yes" | "no" }?
xforms.function.content =
    xforms.var*,
    (xforms.function.sequence* | xforms.function.script*)
# The signature attribute of the function element has the following syntax.
# It might be possible to write a regular expression that matches it, but
# here we just use unrestricted text.
# CustomFunctionSignature     ::=    FunctionName "(" ParamList? ")" 
("as" SequenceType)?
# FunctionName     ::=    QNameButNoNCName
# ParamList     ::=    Param ("," Param)*
# Param     ::=    "$" QName TypeDeclaration?
# TypeDeclaration     ::=    "as" SequenceType
CustomFunctionSignature = text
xforms.function.sequence = element sequence { 
xforms.function.sequence.attrib, xforms.function.sequence.content }
xforms.function.sequence.attrib =
   xforms.Common.attrib,
    attribute value { XPathExpression }
xforms.function.script = element script  { 
xforms.function.script.attrib, xforms.function.script.content }
xforms.function.script.attrib =
   xforms.Linking.attrib,
   attribute type { mediatype.datatype.nocharset },
   attribute charset { mediatype.charset }?
xforms.function.script.content = text

Just before the "# AVT Simple Types" section, add this section:

# mediatype and charset
mediatype.datatype = xsd:token
mediatype.datatype.nocharset = xsd:token
charset.datatype = xsd:token


Leigh.

Received on Wednesday, 18 April 2012 17:59:59 UTC