Open xatapult opened 5 days ago
Ah, that probably explains my confusion the other day.
It's a shame we were inconsistent about this. We're going to have to fix it, I fear, backwards incompatiblity or no.
I think an argument can be made for either set of properties having priority:
Which was does consensus blow?
I'm writing code now that has to store documents produced by XSLTs that set <xsl:output>
serialization properties. There is no guarantee that the stylesheet writers made the right decisions on this, usually it is just copied from somewhere without thinking. It is not of interest to them, except for when they are running the stylesheet outside the XProc context, for development or debugging. And those serialization settings do not have to be the same as the desired ones for production.
With this use case in mind, I would argue that if you explicitly set serialization properties in your XProc code, these should have precedence.
I'm also pretty sure that the consensus was to give the step serialization properties precedence.
Because: I have now code that worked fine until a recent version change of Morgana, when Achim implemented the precedence of document-properties. I traced my problems back to this change. So somewhere along the way we decided to do things different than we used to with respect to the serialization. I don't know where it crept in, but I hope it's not too late to revert...
Well, if there's evidence that it was "steps get priority" probably until I kicked the hornet's nest poking around in the validate with DTD tests, I'm happy to go with that.
Curious what the others think or remember about this... @gimsieke , @xml-project Any comments?
I neither have a recollection nor a preference. Also I’m between meetings at Frankfurt Book Fair.
I remember we talked about this, but I cannot remember the result. I tend to agree to unify the behaviour, however this will be a pain to pipeline authors. So I would prefer the method with the smallest number of changes to XProc and therefore to existing pipelines.
Apart from this, I have exactly the opposite intuition as Erik. My reasoning goes this way: Having a serialization property on a document is something I almost never do in my pipelines. I rely on the step's option to be the general case. That said means, a serialization property on the document is the special case, indicating that this document has to be handled special. And then I would want the property on the document to take precedence over the general case rulings on the step.
I do not think this is a crucial argument, because I could get the described behavior with just a p:choose to handle the general and the special case. This might be the better technique anyways to make the pipeline more readable.
Does this make sense to anyone?
Yes, it makes sense to me. I can very definitely see both sides of this. From a practical perspective:
What does your implementation do, @xml-project and in which cases?
Morgana now implements the standard correctly (as it is described now): document properties first.
However, I still think this is a mistake, because of a very common use-case:
<xsl:output>
element. And and are therefore not deliberately applied.serialization
option on the output port or the p:store
.@ndw Will investigate this.
Anyway, if you do need specific serialization properties, you can always set them:
<p:set-properties properties="map{'serialization': map{...} }"/>
<p:store href="..."/>
This is what I do now in my code (had to, the stylesheets are not under my control, the serialization was prescribed).
You could of course also strip off the serialization
document-property after an p:xslt
step. However, that is not easy, there is no p:remove-properties
step...
The core spec says about serialization parameters here
If I interpret this correctly: serialization properties set in a step's option (for instance
p:store
, optionserialization
) have precedence over a document-propertyserialization
.However, if I look at the
p:store
here, it says:That's the other way around... isn't it? Or am I reading things wrong?
Anyway: if we mixed this up, I think the way the core spec describes it makes more sense: when you explicitly set serialization on a step (or anywhere in the XProc code), that IMHO should take precedence.