How can I prevent Inkscape adding 'style' attribute?

Asked by Anton

How can I prevent Inkscape adding 'style' attribute after saving svg-document? I'm using css styles and after saving all elements take a 'style' attribute and css began useless.

Manual removing after saving is almost kill me. Help.

Update: it's not after saving, but after working with elements in editor. Only those elements get 'style' attribute.

Question information

Revision history for this message
Hachmann (marenhachmann) said :
#1

Does it work if you export as 'Optimized SVG' instead of saving, and uncheck the option 'convert CSS attributes to XML attributes"?

Revision history for this message
Anton (creepton) said :
#2

Thanks. I tried this, but it's the same. I made a mistake, that style attributes appear in elements after I work with those in Inkscape.
So, if I move element, it gets the 'style', but if I dont touch element, it stay in unchanged. May be it's not about saving. Update description.

Revision history for this message
su_v (suv-lp) said :
#3

On 2015-12-13 18:42 (+0100), Hachmann wrote:
> Does it work if you export as 'Optimized SVG' instead of saving, and
> uncheck the option 'convert CSS attributes to XML attributes"?

AFAIU the OP wants to 'check' that option, not uncheck it (it would convert the inline CSS styles written by Inkscape for new and edited objects to presentation attributes if possible). In my understanding presentation attributes can be overridden by CSS styling (external or inline), if supported by the SVG viewer:
«The presentation attributes thus will participate in the CSS2 cascade as if they were replaced by corresponding CSS style rules placed at the start of the author style sheet with a specificity of zero. In general, this means that the presentation attributes have lower priority than other CSS style rules specified in author style sheets or ‘style’ attributes.»
http://www.w3.org/TR/SVG11/styling.html#UsingPresentationAttributes

An alternative would be to test the new extension included in Inkscape 0.91:
'Extensions > Stylesheet > Merge styles into CSS ...'
(New in 0.91, not tested a lot AFAIK, and with known issues, e.g. bug #1295343)

Another option might be the custom extension 'Refresh CSS' attached in the comments of this report:
* Bug #167937 “CSS class references being persisted in style attributes”
  https://bugs.launchpad.net/inkscape/+bug/167937

Revision history for this message
Anton (creepton) said :
#4

>> Bug #167937: CSS class references being persisted in style attributes

Well, that is my case. I'll try an extension, thank you.

Can you help with this problem?

Provide an answer of your own, or ask Anton for more information if necessary.

To post a message you must log in.