- From: Norm Tovey-Walsh <ndw@nwalsh.com>
- Date: Thu, 06 Feb 2025 10:06:00 +0000
- To: David Birnbaum <djbpitt@gmail.com>
- Cc: Martin Honnen <martin.honnen@gmx.de>, xproc-dev@w3.org
David Birnbaum <djbpitt@gmail.com> writes: > <p:viewport> provides the positional offset of the current context item through p:iteration-position(), and the size of the viewport, if needed, is available in p:iteration-size (). I think that's comparable to $p:index with <p:label-elements>, but perhaps there's a difference that I've overlooked. I think that most uses of p:label-elements could be replaced by p:viewport with an appropriate subpipeline. If what you want to do is “label elements”, just add xml:id attributes for example, then p:label-elements is probably faster and certainly simpler to write. > After posting (!), I did notice one other difference: <p:viewport> sets a context that can look only downward, while <p:label-elements> seems to have access to the entire original document tree. That’s true. In a p:viewport, the matched units are documents in their own right, rooted at the place where the match occurred. > but is there something that <p:viewport> with <p:add-attriibute> can do that <p:label-elements> can't do? Probably not (subject to proof by contradiction by someone sufficiently clever) if *all* you want to do is label elements. But in a p:viewport you could add a label and do any number of other things before or after doing so. Be seeing you, norm -- Norm Tovey-Walsh <ndw@nwalsh.com> https://norm.tovey-walsh.com/ > Some circumstantial evidence is very strong, as when you find a trout > in the milk.--Henry David Thoreau
Received on Thursday, 6 February 2025 10:06:09 UTC