ietf-tools / svgcheck

Check SVG against RFC schema

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

allow / verify embedded CSS in SVG

oli-arborum opened this issue · comments

When using svgcheck on an SVG file that contains embedded CSS, it emits the following error message:

1.svg:9: The element 'style' is not allowed as a child of 'svg'
INFO: File conforms to SVG requirements.

I think this is a contradiction: When 'style' is not allowed, then the file also does not conform to the SVG requirements, right?

Furthermore it would be great when svgcheck also would be able to verify the embedded CSS.

The SVG file basically looks like

<?xml version="1.0" encoding="UTF-8" standalone="no"?>

<svg xmlns="http://www.w3.org/2000/svg"
    width="105mm"
    height="105mm"
    viewBox="0 0 60 80"
    version="1.1">

<style type="text/css">
    <![CDATA[
        .ThickLine {
            fill:none;
            stroke:black;
            stroke-width:2;
        }
        .ThinLine {
            fill:none;
            stroke:black;
            stroke-width:1;
        }
        /* some more styles */
    ]]>
</style>

<g>
    <g class="ThinLine">
        <path d="m 15,35 l 0,35" />
    </g>
    <g class="ThickLine">
        <path d="m 15,35 l 25,0" />
    </g>
</g>

</svg>

As per RFC 7996 Section 2.1 style is not in the list of allowed elements for SVG 1.2 RFC.

This is probably something that should be discussed in RSWG mailing list.

Sorry, I wasn't aware that this svgcheck tool only checks features defined in the mentioned RFC (SVG profile "SVG 1.2 RFC").