Bug 64119 - FILESAVE: Buggy CSS stylesheet in exported XHTML
Summary: FILESAVE: Buggy CSS stylesheet in exported XHTML
Status: ASSIGNED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Spreadsheet (show other bugs)
Version: 4.0.2.1 rc
Hardware: Other Linux (All)
: medium normal
Assignee: Marco Biscaro
QA Contact:
URL:
Whiteboard: BSA EasyHack DifficultyBeginner
Keywords:
Depends on:
Blocks:
 
Reported: 2013-05-01 15:49 UTC by Rainer Klute
Modified: 2013-10-04 18:46 UTC (History)
2 users (show)

See Also:
i915 platform:
i915 features:


Attachments
ZIP file containing a sample ODS document and the corresponding XHTML export. (9.38 KB, application/x-zip)
2013-05-01 15:49 UTC, Rainer Klute
Details

Description Rainer Klute 2013-05-01 15:49:30 UTC
Created attachment 78726 [details]
ZIP file containing a sample ODS document and the corresponding XHTML export.

When exporting an ODS document as XHTML, the CSS stylesheet contained in the <style> element is buggy in several respects:

1. The border-width attribute is exported has a comma instead of a point as decimal separator, e.g. border-width:0,021cm instead of border-width:0.021cm. Other width attributes seem to be okay.

2. The stylesheet contains XML-like comments, e.g. <!-- ODF styles with no properties representable as CSS -->. However, CSS comments must be Java style, e.g. /* ODF styles with no properties representable as CSS */

3. The stylesheet contains empty blocks, e.g. { }. This is invalid.
Operating System: Linux (Other)
Version: 4.0.2.1 rc
Comment 1 David Tardon 2013-05-02 07:07:21 UTC
Well, these are three different bugs, so there should be three reports. But let's ignore the technicalities... IMHO at least the first two bugs should be very easily fixable by anyone who knows XSLT, so I am marking this as EasyHack. 

The code in question is filter/source/xslt/odf2xhtml with some parts in filter/source/xslt/common . Some pointers to the individual problems:

1. I would start looking at template round-up-border-width in filter/source/xslt/odf2xhtml/export/common/styles/style_mapping_css.xsl .

2. This is because of the use of xsl:comment in the CSS export code, e.g., template create-page-layout in filter/source/xslt/odf2xhtml/export/xhtml/header.xsl . Obviously these must be changed to plain /* */.

3. I have not been able to spot a likely problematic place in a quick look, so I leave this as excercise to the reader :-)
Comment 2 Marco Biscaro 2013-05-11 02:51:17 UTC
#2 and #3 fixed in https://gerrit.libreoffice.org/#/c/3851

But #1 is a locale problem. In locales where the decimal separator is a comma (like de_DE or pt_BR), the output CSS is wrong. What should be done in this case?
Comment 3 Rainer Klute 2013-05-11 05:46:26 UTC
CSS output should never be localized, but the decimal point must always be a dot ('.'). See the specification here: <http://www.w3.org/TR/CSS2/syndata.html#numbers>.
Comment 4 Marco Biscaro 2013-05-11 19:41:17 UTC
Yes, I know the decimal separator cannot be localized in CSS. What I meant is how can we prevent it to be localized (since it does the localization automatically when doing any calculation)?
Comment 5 Björn Michaelsen 2013-10-04 18:46:55 UTC
adding LibreOffice developer list as CC to unresolved EasyHacks for better visibility.

see e.g. http://nabble.documentfoundation.org/minutes-of-ESC-call-td4076214.html for details


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.