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

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

From: Tab Atkins Jr. <jackalmage@gmail.com>
Date: Thu, 12 Jun 2014 13:19:56 -0700
Message-ID: <CAAWBYDDcjxHS8FAWVPPnp8QfiU5Sw9QKjbfrEopt-5-mwQ306g@mail.gmail.com>
To: Jirka Kosek <jirka@kosek.cz>
Cc: W3C Style <www-style@w3.org>
On Thu, Jun 12, 2014 at 11:24 AM, Jirka Kosek <jirka@kosek.cz> wrote:
> Hi,
>
> suppose simple use-case. There is date of the last modification stored
> in a <meta> element using Dublin Core:
>
> <meta name="DCTERMS.modified" content="2001-07-18">
>
> and I want to put this date into the footer but formatted using Czech
> locale. There is currently no provision for this.
>
> One way to solve this is to provide additional function called xpath()
> that will accept any XPath 2.0 expression and which could be used in a
> content property and in places where content() function can be used.
> XPath 2.0 already provides date, time and number formatting functions
> and operates on document tree. So there will be no need to reinvent
> everything from the scratch.
>
> I mean this seriously. If CSS is supposed to fill space where currently
> XSL is used more advanced data transformation prior rendering are needed.
>
> Please note that there are already implementations supporting this, for
> example:
>
> http://www.oxygenxml.com/doc/ug-editor/concepts/dg-xpath-function.html
>
> http://www.xmlmind.com/xmleditor/_distrib/doc/csssupport/xpath.html

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().

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.

~TJ
Received on Thursday, 12 June 2014 20:20:44 UTC

This archive was generated by hypermail 2.3.1 : Monday, 2 May 2016 14:39:22 UTC