Bug 106780 - FILESAVE, ODF: attribute text:style-name is invalid in table:table-template
Summary: FILESAVE, ODF: attribute text:style-name is invalid in table:table-template
Status: VERIFIED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Impress (show other bugs)
Version:
(earliest affected)
4.0 all versions
Hardware: x86 (IA32) Windows (All)
: medium normal
Assignee: Michael Stahl (allotropia)
URL: http://docs.oasis-open.org/office/v1....
Whiteboard: odf odf_validation target:6.1.0 targe...
Keywords: difficultyMedium, easyHack, skillCpp
Depends on:
Blocks: ODF-export-invalid
  Show dependency treegraph
 
Reported: 2017-03-26 17:43 UTC by Regina Henschel
Modified: 2020-05-27 12:45 UTC (History)
6 users (show)

See Also:
Crash report or crash signature:


Attachments
Example with wrong attribute (11.54 KB, application/vnd.sun.xml.impress)
2017-03-26 17:43 UTC, Regina Henschel
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Regina Henschel 2017-03-26 17:43:12 UTC
Created attachment 132155 [details]
Example with wrong attribute

LibreOffice writes an attribute 'text:style-name' in an element 'table:table-template'. But it should be an attribute 'table:style-name', see <define name="table-table-template-attlist"> in schema line #12240.

To reproduce the problem, take a new Impress document and insert a table. Save it, unpack and look in file styles.xml. Search for element <table:table-template>

It is likely line #596 in method XMLTableExport::exportTableTemplates() in /core/xmloff/source/table/XMLTableExport.cxx

I think, this line was forgotten when bug 35190 was fixed.
Comment 1 Xisco Faulí 2017-03-27 14:36:55 UTC
@Thorsten, would you mind commenting on this one as you were the one who fixed bug 35190 ?
Comment 2 Thorsten Behrens (allotropia) 2017-11-12 23:18:44 UTC
(In reply to Xisco Faulí from comment #1)
> @Thorsten, would you mind commenting on this one as you were the one who
> fixed bug 35190 ?

Ah - so yeah, what Regina suggests.
Comment 3 Thorsten Behrens (allotropia) 2017-11-12 23:25:02 UTC
line #609 meanwhile
Comment 4 Regina Henschel 2017-11-12 23:52:39 UTC
Correction: The element <table:table-template> is in chapter 16.18. The correct attribute is table:name, which is specified in 19.673.14, in OpenDocument-v1.2-os-schema.rng line #12240.
Comment 5 abstatic 2018-01-23 07:36:34 UTC
Hi,

I have submitted a patch for this at https://gerrit.libreoffice.org/#/c/48373/

Now the name for attribute in table-template is table:name.
Comment 6 Michael Stahl (allotropia) 2018-01-23 21:27:29 UTC
it looks like the code to import this style:name attribute was added in commit 40fba0f4418084d50cc5c388cb0b6e1abe395d61 "GSoC Writer Table Styles Import"
for the 5.3 release.

guess we can probably get away with changing this for 6.1 but i don't want this fix backported to earlier releases.
Comment 7 Michael Stahl (allotropia) 2018-01-23 21:38:54 UTC
actually i have an improved suggestion: we can write both the wrong and the correct attribute, then LO < 5.3 can still read the wrong attribute.

except if the user has set a "strict" ODF version, then write only the correct attribute.

look around line 634 in XMLTableExport.cxx, there is a variable of type
ODFSaneDefaultVersion, and the next line has the needed check of that variable,
so very easy to do this.
Comment 8 abstatic 2018-01-26 13:21:09 UTC
Okay. So for LO versions < 5.3 the XML should look like-

<table:table-template text:style-name="default" text:style-name="default">

But if the strict version is set then the XML would be-

<table:table-template text:style-name="default">

Is this correct?
Comment 9 abstatic 2018-01-26 14:02:28 UTC
> <table:table-template text:style-name="default" text:style-name="default">
<table:table-template table:name="default" text:style-name="default">

> But if the strict version is set then the XML would be-
> 
> <table:table-template text:style-name="default">
 
> Is this correct?
Comment 10 Michael Stahl (allotropia) 2018-01-26 14:19:06 UTC
(In reply to abstatic from comment #9)
> <table:table-template table:name="default" text:style-name="default">
> 
> > But if the strict version is set then the XML would be-
> > 
> > <table:table-template text:style-name="default">
>  
> > Is this correct?

almost :) 50% correct :) the strict version should be:

<table:table-template table:name="default">
Comment 11 Commit Notification 2018-01-29 09:15:01 UTC
Abhishek Shrivastava committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=e3e2f6911d6231c706ce8c77e5cd6733335d6342

tdf#106780 Fix for invalid attribute in impress ODF

It will be available in 6.1.0.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 12 Commit Notification 2018-01-29 10:18:06 UTC
Abhishek Shrivastava committed a patch related to this issue.
It has been pushed to "libreoffice-6-0":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=5563f111d5700bb03884cd469288b09281e37dd1&h=libreoffice-6-0

tdf#106780 Fix for invalid attribute in impress ODF

It will be available in 6.0.1.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 13 Commit Notification 2018-01-29 14:36:29 UTC
Abhishek Shrivastava committed a patch related to this issue.
It has been pushed to "libreoffice-5-4":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=fa3b7206f1b6f11dc3d133d06289aaaad3e422fd&h=libreoffice-5-4

tdf#106780 Fix for invalid attribute in impress ODF

It will be available in 5.4.5.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 14 Regina Henschel 2020-03-08 17:49:26 UTC
The wrong attribute text:style-name is still written in "ODF 1.2 extended" in addition to table:name. But that attribute is not needed at all, because table:name is already written. And "text" is an OASIS namespace and not a private namespace and therefore may not be used in this context.
Comment 15 Commit Notification 2020-05-19 15:04:06 UTC
Michael Stahl committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/d6ba23a7c0fbd4b59b8011012bbcaa002c5c84ca

tdf#106780 xmloff: ODF export: only write invalid text:style-name...

It will be available in 7.0.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 16 Michael Stahl (allotropia) 2020-05-20 10:57:52 UTC
fixed now on master:
invalid attribute is only written in ODF 1.2 Extended (compatibility mode) which is intended for such things
Comment 17 Regina Henschel 2020-05-27 12:45:25 UTC
Seen OK in Version: 7.0.0.0.alpha1+ (x64)
Build ID: 0a7341c26741f16835c9062c309e7d3a7fca8209
CPU threads: 8; OS: Windows 10.0 Build 18362; UI render: Skia/Raster; VCL: win
Locale: de-DE (en_US); UI: en-US
Calc: CL