The specification of start-offset is quite complex IMO, but yet it does not provide the ultimate generic solution for any marker search.
The start-offset attribute offsets the start of the search by the specified number of pages. This applies irrespectively of the scope of the search.
By default, the search begins on the page where the marker-reference element is placed. The search, once combined with a non-zero start-offset, could start on a non-existing page. If the search direction is the same as the offset direction, the search would never hit an existing page and the empty string is returned. However, if the search direction is opposite to the offset direction, the search could eventually hit an existing page. Depending on the scope, the following applies in this particular situation:
- page-content
- return the empty string
- page
- return the empty string
- spread
- if the current page belongs to the same spread as the page with the specified offset (had it existed), start the search on the first existing page in the search direction, otherwise return the empty string
- sheet
- if the current page belongs to the same sheet as the page with the specified offset (had it existed), start the search on the first existing page in the search direction, otherwise return the empty string
- sequence
- start the search on the first existing page in the search direction
- volume
- start the search on the first existing page in the search direction
- document
- start the search on the first existing page in the search direction
The specific use case I have in mind, that is not supported, is to do a marker search within the current volume, going forward from the first page of the volume, or going backward from the last page of the volume.
From the specification it seems (I haven't actually tested it) that for scopes sequence, volume and document, starting on a page that is not within the scope does not automatically result in an empty result, so you could use a very high (negative resp. positive) offset, so that you can be sure that you start on a page that is in one of the previous resp. next volumes, or does not exist, and so that you eventually hit the first resp. last page of the current volume.
However, "using a very high number" feels like a bit of a hack.
Another issue with the specification is that it is not clear where the search starts for the various scopes (unless I didn't read properly, please correct me if I missed something).
I think things could be improved / made more explicit by replacing the attribute with a more general start, that takes either a keyword, or an integer number like start-offset, to maintain backward compatibility. We would deprecate start-offset.
Valid keywords would be:
begin-of-scope (default for forward)
begin-of-page
end-of-page (default for backward)
end-of-scope
Instead of:
<marker-reference marker="foo" scope="volume" start-offset="10000" direction="backward"/>
I could then use:
<marker-reference marker="foo" scope="volume" start="end-of-scope" direction="backward"/>
The specification of
start-offsetis quite complex IMO, but yet it does not provide the ultimate generic solution for any marker search.The specific use case I have in mind, that is not supported, is to do a marker search within the current volume, going forward from the first page of the volume, or going backward from the last page of the volume.
From the specification it seems (I haven't actually tested it) that for scopes
sequence,volumeanddocument, starting on a page that is not within the scope does not automatically result in an empty result, so you could use a very high (negative resp. positive) offset, so that you can be sure that you start on a page that is in one of the previous resp. next volumes, or does not exist, and so that you eventually hit the first resp. last page of the current volume.However, "using a very high number" feels like a bit of a hack.
Another issue with the specification is that it is not clear where the search starts for the various scopes (unless I didn't read properly, please correct me if I missed something).
I think things could be improved / made more explicit by replacing the attribute with a more general
start, that takes either a keyword, or an integer number likestart-offset, to maintain backward compatibility. We would deprecatestart-offset.Valid keywords would be:
begin-of-scope(default for forward)begin-of-pageend-of-page(default for backward)end-of-scopeInstead of:
I could then use: