[Bug 3771] [FS] technical: interleaved with empty text nodes

http://www.w3.org/Bugs/Public/show_bug.cgi?id=3771





------- Comment #8 from jmdyck@ibiblio.org  2008-03-11 03:19 -------
Re the type-unsoundness problem of comment #6, here is my proposed solution.
It eliminates the interleaved text{""} nodes from the normalization of direct
element constructors. To "distinguish" enclosed expressions, each is instead
normalized to a separate function call.

Roughly speaking, we split the (intended) semantics of
    fs:item-sequence-to-node-sequence
into two fs functions, called fs:A and fs:B here for brevity.  With respect to
XQuery 3.7.1.3, fs:A represents step 1e (the processing of enclosed
expressions, including node-copying and all that that entails), and fs:B
represents steps 2 through 4 (the processing of the constructor's whole content
sequence).

(I'd suggest that fs:A inherit the name fs:item-sequence-to-node-sequence, and
fs:B get the name fs:element-content-sequence.)

The specific changes to rules would be as follows. (Of course there would be
collateral changes to the prose and examples.)

4.7.1 Direct Element Constructors / Norm / rule 3
    Change fs:item-sequence-to-node-sequence to fs:B
    Delete the interleaved text{""} items.

4.7.1 Direct Element Constructors / Norm / rule 8
    Change to:
        [[ { Expr } ]]_ElementContentUnit
        ==
        fs:A(( [[ Expr ]]_Expr ))

4.7.3.1 Computed Element Constructors / Norm / rule 2+3
    Change
        fs:item-sequence-to-node-sequence(...)
    to
        fs:B( fs:A(...) )

7.1.5 The fs:item-sequence-to-node-sequence function
    Split it into sections for fs:A and fs:B as follows.

    For brevity here, I leave out the "statEnv |-" and use the following
    abbreviations:
        Child_Type -> (element*|text|processing-instruction*|comment)
        A(Type)    -> (FS-URI,"A")(Type)
        B(Type)    -> (FS-URI,"B")(Type)

    Also for brevity, I leave out the "statEnv |-".

    The STA rules for fs:A would be:

        Type   <: attribute**
        ---------------------
        A(Type) : attribute**

        Type   <:              (Child_Type|document|xs:anyAtomicType)*
        --------------------------------------------------------------
        A(Type) :              (Child_Type|document)*

        Type   <: attribute**, (Child_Type|document|xs:anyAtomicType)*
        --------------------------------------------------------------
        A(Type) : attribute**, (Child_Type|document)*

    The STA rule for fs:B would be:

        Type   <: attribute**, (Child_Type|document)*
        ---------------------------------------------
        B(Type) : attribute**, Child_Type*

Received on Tuesday, 11 March 2008 03:20:07 UTC