xproc / 3.0-steps

Repository for change requests to the standard step library and for official extension steps
10 stars 7 forks source link

p:ixml should always wrap output into ixml element #494

Closed innovimax closed 2 months ago

innovimax commented 2 years ago

I think that the principle of least surprise (POLA) enforce the idea that the output should be consistent whatever the context we're in

At the moment, the specification as it is gives different ixml or no wrapper on different context

I would recommend that example 2, 4 and 5 to add a wrapper to avoid surprises

ndw commented 2 years ago

I don't think so. In the case where the grammar parses successfully and a single parse is returned, the root element is determined by the users grammar. In the first example, the root element is ixml because that's the root element in the ixml grammar. In the third example, I added ixml because the parse failed. In the sixth example, I added ixml because the user asked for multiple parses. On further thought, the step should probably just return a sequence of results in that case.

innovimax commented 2 years ago

Then perhaps, unwrapping example 3 and example 6 would do the trick