W3C home > Mailing lists > Public > www-style@w3.org > June 2014

Re: [css-gcpm] content() function doesn't allow formatting of values

From: Jirka Kosek <jirka@kosek.cz>
Date: Fri, 13 Jun 2014 10:06:25 +0200
Message-ID: <539AB101.8020006@kosek.cz>
To: "Tab Atkins Jr." <jackalmage@gmail.com>
CC: W3C Style <www-style@w3.org>
On 12.6.2014 22:19, Tab Atkins Jr. wrote:
> It sounds like this has nothing to do with content().  Your example
> isn't even remotely doable with content(), since the content you're
> trying to get at is an attr value; it'd need attr().

Sorry, you are right. But given apart date formatting issue for now, I
doubt that current draft allows even putting metadata into
headers/footers. I can do something like:

meta[name="DCTERMS.modified"] {
  string-set: last-modified-date attr(content)

@page {
   @top-center {
     content: string(last-modifed-date)

But this shouldn't work as string-set is not working on elements which
are not generating boxes (see "The content values of named
strings are assigned at the point when the content box of the element is
first created (or would have been created if the element’s display value
is none). The entry value for a page is the assignment in effect at the
end of the previous page. The exit value for a page is the assignment in
effect at the end of the current page.")

Then this is a serious limitation itself. It should be possible to put
arbitrary content from the document into a header/footer. Is there any
provision for using arbitrary selector inside content, something like:

content: query(meta[name="DCTERMS.modified"]::attr(content))

That would help in many cases, but once more complex processing is
required, selectors will not be enough: With XPath support one could write:

content: xpath("//meta[@name='DCTERMS.modified']/@content/format-date(.,
'[D]. [M]. [Y]')")

> You're asking, it looks like, for a way for CSS to reformat a
> date/time/number value into a specific localization format.  We've
> discussed this before; Håkon had a proposal for an env() function and
> some formatting options, which I thought he had in some draft, though
> I can no longer find it.  I think it's a good idea; we'd have to
> define how to parse text into the given abstract format (or lean on
> some other part of the web platform that already does this parsing, to
> be consistent), and then for the output I assume we'd follow the
> example of the JS l10n API in terms of arguments and abilities.

I think that respecing what is already done in XPath is regarding dates
is lost time. Also date/time/numbers are not only problem. Consider
keywords stored as


Now you want to display them as "A, B, C". This is doable with some
fiddling using ::after and :last-child(). But when this should go to
header/footer it's not longer possible. The question is whether this
should be doable in sole CSS. But if the answer is yes, then we need
much powerful machinery for generated content then current definition of
content property allows.


  Jirka Kosek      e-mail: jirka@kosek.cz      http://xmlguru.cz
       Professional XML consulting and training services
  DocBook customization, custom XSLT/XSL-FO document processing
 OASIS DocBook TC member, W3C Invited Expert, ISO JTC1/SC34 rep.
    Bringing you XML Prague conference    http://xmlprague.cz

Received on Friday, 13 June 2014 08:06:56 UTC

This archive was generated by hypermail 2.4.0 : Monday, 23 January 2023 02:14:41 UTC