W3C home > Mailing lists > Public > public-digipub@w3.org > August 2015

Re: Cross-References in GCPM (was: CSS Pages and Pagination)

From: Sanders Kleinfeld <sanders@oreilly.com>
Date: Mon, 10 Aug 2015 12:34:17 -0400
Message-ID: <CAD1Cp0t0zS5x6sH8KAdFdQ1puSs8CnFxyYOe=cgs4HSD6ETj4A@mail.gmail.com>
To: Håkon Wium Lie <howcome@opera.com>
Cc: Daniel Glazman <daniel.glazman@disruptive-innovations.com>, public-digipub <public-digipub@w3.org>
Thanks very much for your feedback, Håkon. My responses inline below.

On Sun, Aug 9, 2015 at 7:50 AM, Håkon Wium Lie <howcome@opera.com> wrote:
> Sanders Kleinfeld wrote:
>
>  > Re: cross-references, the main use case I would love to see covered is
>  > the ability to automatically customize the text content based on the
>  > type of element that is being linked to. So for example, if we had
>  > markup like the following:
>  >
>  > <section>
>  >   <h1 id="a_section">The First section title</h1>
>  >   <p>Some text here</p>
>  >    <figure id="a_figure">
>  >       <figcaption>An interesting icon</figcaption>
>  >       <img src="icon.gif"/>
>  >    </figure>
>  >
>  >    <p>In <a href="#a_section"/>, we have some cross references.</p>
>  >    <p>In <a href="#a_figure"/>, we have an icon image</p>
>  > </section>
>  >
>  > We might want the cross-reference to the section heading (#a_section)
>  > to contain the text "Section 1.1", and the cross-reference to the
>  > figure caption to contain the text "Figure 1.1".
>
> You could this by adding a class to the <a> element, e.g.:
>
>   <a class=figref href=...>
>
> Combined with something like:
>
>   a.figref:before { content: "Figure: " }
>
> But I guess you're looking for a solution where you only insert simple
> <a> elements that transform themselves?

Correct! That lowers the burden on the content creators who produce the markup.

>
> Sometimes this could lead to errors. E.g:
>
>   See figure 2.3 on page 56.
>   Figure 2.3 on page 56 illustrates this.
>
> That is, the spelling of figure/Figure changes, this would be tough to
> adjust automatically.

That's an excellent point. But from several years of experience in
working around edge cases with autogenerated XREFs and punctuation, I
can say that we've found that a fully automated solution is worth the
tradeoff of occasionally needing workarounds. Other publishers may
disagree with me here, though :)

>
> Still if you want an all-automatic solution, I'd probably base it on
> named strings. First, I would set a named string with:
>
>   h1[id] { string-set: ref "Section " counter(sec) }
>   figure[id] { string-set: ref "Figure " counter(fig) }
>
> Then I would refer to it with:
>
>   a { content: target-string(ref, attr(href url)) }
>
> The 'target-string' function doesn't exist, yet. But I think it could work, no?

Yes, that's exactly what I would be looking for! I think leveraging
string-set is the right way to go here.

>
> Cheers,
>
> -h&kon
>               Håkon Wium Lie                          CTO °þe®ª
> howcome@opera.com                  http://people.opera.com/howcome
Received on Monday, 10 August 2015 16:39:12 UTC

This archive was generated by hypermail 2.3.1 : Monday, 10 August 2015 16:39:13 UTC