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

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