XHTML and li/@value attribute

General TRichView support forum. Please post your questions here
Post Reply
martindholmes
Posts: 131
Joined: Mon Aug 29, 2005 12:03 pm

XHTML and li/@value attribute

Post by martindholmes »

In CRVData.pas, TCustomRVData.SaveHTMLToStreamEx, this appears at line 3136:

if marker.GetLevelInfo(RVStyle).HasNumbering then
RVWrite(Stream,Format('<li value=%s',
[RV_HTMLGetIntAttrVal(marker.Counter, Options)]))

However, the "value" attribute is not allowed in XHTML 1.0 Strict or 1.1. In fact, it was deprecated in HTML 4.01 (http://www.w3.org/TR/html401/struct/lis ... f-value-LI). (It does seem to return in a draft of XHTML 2.0, but I'm not sure if that's serious or not.) I'm aiming for XHTML 1.1 compliance using SaveHTMLEx, and the attribute is causing files to be invalid.

I'd like to suggest two things:
  • 1. Since the default value is "1", I think when that IS the value, then no attribute should be inserted at all. That will solve the problem for most situations anyway.

    2. When the output format is XHTML 1.1, no value attribute should be inserted. The standard suggests that CSS should be used instead, so perhaps an alternative would be to use style="counter-reset..." (http://www.w3.org/TR/CSS21/generate.html#counters) wherever the first item is NOT the default 1.
Cheers,
Martin
Sergey Tkachenko
Site Admin
Posts: 17569
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

When I tried to implement HTML saving of list styles, I tried CSS counters at first. But unfortunately, at that time, none of browsers supported them. I do not know how it is now, but since IE6 is still widely used, I cannot use them.
And unfortunately, CSS does not allow to control counter values for <LI>.

I think that for HTML counter values must be saved, even if they are deprecated, because there is no working alternative for them.
But since XML is more strict, I'll remove this attribute for XHTML.
martindholmes
Posts: 131
Joined: Mon Aug 29, 2005 12:03 pm

Post by martindholmes »

The vast majority of lists start from 1, so I don't think there's much to lose there. Also, I think anyone using XHTML 1.1 doesn't care about IE6 (we don't support it in any of our projects, and we haven't for a long time), so I think removing the attribute in XHTML is definitely the right decision.

According to the specification, you can control numbering of <li> tags in CSS (I think you use counter-reset), and the last time I tried it, it worked in at least a couple of browsers. And in any case, it doesn't really matter whether it works right now in many browsers or not; people choose XHTML because they care about stability and longevity, and anyone coding an app with TRichView right now is presumably going to release it a year or two down the road, and then hope people use it for four or five years.

Cheers,
Martin
Post Reply