Skip to content
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

Make most steps accept sequences #59

Open
xatapult opened this issue Nov 8, 2024 · 1 comment
Open

Make most steps accept sequences #59

xatapult opened this issue Nov 8, 2024 · 1 comment

Comments

@xatapult
Copy link
Contributor

xatapult commented Nov 8, 2024

A lot of the standard steps don't accept sequences. E.g. p:wrap, p:delete, etc. Why not? It seems like an arbitrary limitation. Why not make all these steps accept sequences. They then just perform their magic on all members of the sequence (or do nothing in case of an empty sequence).

IMHO the fact that sequences are "special" is a left-over from the XProc 1 days. It is more in line with the XPath standard to think of a single document also as a sequence, but just with one member. If you look at it like that it makes sense to treat sequences of all sizes in the same way.

@ndw
Copy link

ndw commented Nov 8, 2024

Implicit sequences are certainly a possibility. I remember discussing this issue at the very first XProc f2f meeting. There was some support for implicit sequences and some support for explicit sequences (xsl:for-each and friends). In the end, the WG decided to go with explicit sequences. But that's not a special left over, it was a conscious design decision.

One compelling argument in favor of explicit sequences is early error detection. If all steps just accept sequences, even empty ones, then it's much harder to get feedback if you've wired things up badly. The pipeline runs, but produces nothing useful, or the wrong things. The fact that passing a sequence to xsl:add-attribute causes it to fail is a signal that you've done it wrong.

The trade-off is probably highly dependent on what the common use cases are for you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants