Re: [EXTERNAL] - Getting rid of @sequence="true/false"?

> Am 26.09.2017 um 09:10 schrieb Norman Walsh <ndw@nwalsh.com>:
> 
> Achim Berndzen <achim.berndzen@xml-project.com> writes:
>> Sorry, I am totally confused now:
>> 
>> First: I agree with Gerrit that we didn't specify arbitrary XDM items
>> on port. (And I think we should not do so.)
> 
> Ok. But if we allow non-XML documents to flow through the pipeline, if
> the language is going to let me construct an arbitrary octet sequence
> and send it as a result, I don’t see how there’s any provision for
> *preventing* me from sending arbitrary XDM values.
> 
> But that doesn’t mean that the language has to recognize them, that we
> have to allow you to match them (with <p:output port="result"
> as="xs:boolean"/>, for example) of course.

Yes, that is the distinction we needed: I try to explain it in my own work, just to check I got it right:

Anything can flow between steps, including but not restricted to 
XDM values. But on the level of XProc 3.0 we have only documents, some of them XML documents where
"/*" will typically yield a result and some non-XML documents, where "/*" will always return an empty sequence.

> My reservations are two-fold, first, I think you’re right, it’s long
> and error prone. Second, if we aren’t going to allow arbitrary XDM
> values, then it’s a weird subset of sequence constructors that I don’t
> really want to have to teach users.
> 
> We want to remove sequence=true/false; would simply adding a
> “cardinality” attribute suffice? (Well, except for the fact that
> cardinality is a terrible, technical name for the attribute.)
> 
> We could add “at-least” and “at-most” attributes, where they both
> default to 1.
> 
>  <p:input port="source" at-least="5" at-most=”7"/>
> 
> I’m not wholly enthusiastic because I think there’s no compelling
> use-case for more control than ?, *, and +. How about occurrence?
> 
>  <p:input port="source" occurrence="*"/>
> 
> Probably still to arbitrary and technical. Maybe
> 
>  <p:input port="source" as="document-node()*"/>
> 
> isn’t that bad. :-)
> 
> 1. It only has to be in the declarations, so most users will never have
>   to type it.
> 2. Even if users create their own steps, they aren’t required to type it.
> 3. It’s very unlikely that users are going to do anything more complicated
>   than just document-node(). Because, while "document-node(element(*,my:HatSize))+"
>   would be valid, it would only be valid if that output port produced only
>   hat size documents. I have a feeling that ports that produce more than
>   one document more often than not produce different kinds of documents.
> 
>                                        Be seeing you,
>                                          norm
> 

Concerning cardinality: In XProc 1.0 we had sequence="true/false" and I think it
it reasonable to have a more fine-grained selection: zero or one, zero or more, one or more
and exactly one.

I doubt that there is a real use case for "at-least 5 but at-most 7". This is why
I like @occurence. As you said its technical, but people know it from XSLT or XQuery. My only argument
against it would be, that "exactly one" has to be default (because we have no marker for it). I would like
to see @sequence=true (occurrence='*') as default. But may be I have to life with that.

@as="{sequence-type-matcher}" is in my opinion over: To type "document-node()*" to say that I am
expecting zero or more documents seems odd.  

I do not see any real case for "document-node(element(*,my:HatSize))+", but may be I am wrong.

Apart from the typing and the resulting errors I would argue, that we should borrow from SequenceTypeSyntax
because then we have to explain, that we borrow only "document test", but that "text()" or "function(*)" is either ignored
or raises an error.

------------------------------------------------
Achim Berndzen
achim.berndzen@xml-project.com

<xml-project /> Achim Berndzen
Kleine Breite 26a
38302 Wolfenbüttel, Germany

http://www.xml-project.com

Received on Tuesday, 26 September 2017 09:18:54 UTC