ietf-tools / svgcheck

Check SVG against RFC schema
BSD 3-Clause "New" or "Revised" License
14 stars 13 forks source link

allow / verify embedded CSS in SVG #37

Open oli-arborum opened 1 year ago

oli-arborum commented 1 year ago

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>
kesara commented 1 year ago

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.

oli-arborum commented 1 year ago

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