-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
What are the semantics of exclude-inline-prefixes? #66
Comments
For what its worth: I think that what the pipeline should do is somehow keep the namespace of the resulting elements intact. How doesn't matter. Maybe with an invented prefix, maybe with a default namespace declaration. If you do an And of course, semantically it doesn't matter how the namespace is declared. It means the same whatever mechanism. |
I'm not sure I understand your answer, @xatapult . In my original question, do you expect the first result, or the second? I think it's uncontroversial that the resulting XML has to be namespace well-formed and all of the elements and attributes have to be in the correct namespaces. |
The spec seems to be clear: Output 1 is a possible outcome, output 2 isn’t since The 1.0 spec already says:
This seems to have been copied to the current spec verbatim. But also in the current spec, in
As an aside: On
So maybe our intent, as expressed in the less formal sentence above, was really to specify that only the namespace declaration(s), not the affected namespace URI(s) altogether, should be omitted in the output. In my view, this also aligns better with what I intuitively expect when seeing an attribute that is called So output 1 is correct, but output 2 should be correct. Therefore I think we should consider altering the spec, even if the semantics differ from 1.0 and even if existing pipelines are affected. |
I am sorry, I am totally confused. Can someone help me out?
This makes me think, that both strategies are possible as they generate a new prefix. |
Consider |
@ndw Thanks, but both of your original examples satisfied this criterion too, don't they? As well as simply keeping "ex". So I am still confused about the discussion. |
Sorry. Not sure where I made things confusing. I don't think the question of keeping the final document namespace well-formed is really at issue. That's not negotiable. The possible distinction is, what's excluded, the specific binding of a namespace URI or all bindings to that URI. |
@ndw wrote:
Ah, ok. Now I got it. Thanks! |
Well, what I mean is: If you're so stupid to exclude namespace prefixes that you'll actually need, your at the mercy of the implementation to fix things. So any outcome you proposed would be ok for me, as long as the XML semantics don't change. However, that's not the direction this discussion is going. Bottom line for me: I don't mind. |
Gerrit proposes that we change the semantics to remove the prefix (and any bindings for the prefix). If there are multiple bindings for the same prefix, they all go. |
In email, Achim made the important point that the current semantics are the same as the semantics for exclude-result-prefixes in XSLT. (Because that was the model we used when we added it to XProc 1.0) I have very cold feet about making a backwards incompatible change here. Achim also observes that we could keep this behavior and add a new feature to provide "remove this binding" I propose we make no change in 3.1 and move this to the Vnext repo. |
Consider this pipeline:
What output does it produce? I think the spec is clear, but I also think that what is specified is sufficiently counter-intuitive that it's perhaps not clear enough. The spec says:
(Where the ellipsis just elides the small amount of faff about how
exclude-inline-prefixes
attributes are combined if they appear on ancestor elements.)I think it follows that this is one possible output:
Critically, the binding for
x
andalt
have been removed because they have the same namespace URI as an excluded prefix. In order to keep the document namespace well-formed, a binding has been re-inserted where it's required. This example usesx
in both places, it could equally have used any random (not otherwise in-scope) prefix (includingex
) and it could have used different prefixes forp
andq
.A more intuitive semantic would be that the binding is excluded. So you'd get something like this:
(I've used the prefix
_1
where a prefix had to be inserted, but equally, I could have usedx
ortest
or even the default namespace. Things are a little more complicated for attributes, but I don't think that's relevant here.)I've implemented what I believe the spec says, so I haven't thought through all of the consequences of the more intuitive semantic.
One consequences, though, would be that
exclude-inline-prefixes
andp:namespace-delete
would have very different semantics. Inp:namespace-delete
(I believe that) it's really important that what is removed is the namespace URI, regardless of the binding. In a random input document, the pipeline author cannot reasonable be expected to know what (all of) the prefixes are for a particular namespace URI. Nor can the author refer to those prefixes in a straightforward way.That's not really as important in a pipeline where the pipeline author has control over all the bindings used.
For more perspectives on this issue, see xmlcalabash/xmlcalabash3#201
The text was updated successfully, but these errors were encountered: