Subject: RE: XSLT and SVG
From: "Chris Bayes" <Chris@xxxxxxxxxxx>
Date: Wed, 20 Sep 2000 13:57:28 +0100
>Chris Bayes wrote:
>> >> >Why not just add a
>> >> >selector of higher specificity that overrides the property
>you want to
>> >> >change?
>> >>
>> >> Not sure what you mean here.
>> >
>> >Specificity, as defined in the CSS spoec.
>> I looked at the spec for the first time today. Well just this bit of it
>> A declaration in the 'STYLE' attribute of an element (see
>section 1.1 for an
>> example) has the same weight as a declaration with an ID-based
>selector that
>> is specified at the end of the style sheet:
>> <STYLE TYPE="text/css">
>>   #x97z { color: blue }
>> </STYLE>
>> <P ID=x97z STYLE="color: red">
>> In the above example, the color of the 'P' element would be red. Although
>> the specificity is the same for both declarations, the declaration in the
>> 'STYLE' attribute will override the one in the 'STYLE' element because of
>> cascading rule number 5.
>> As SVG would usually have a style attribute
>Well, not necessarily but lets assume that this particular example does
>> then specificity doesn't come into it.
>Yes it does; the style attribute with specificity 100 will override all
>selectors with lesser (or equal) specificity but wil litself be overridden
>by a higher specificity selector.
>Here is an example
><g id="foo"><text class="bar"><tspan style="fill: red">hello</tspan>
>the selector
>#foo bar { fill: green }
>will make "hello world" all be green, overiding the style attribute saince
>it has higher specificity.
ok as per rule 4

Sort by specificity of selector: more specific selectors will override more
general ones. To find the specificity, count the number of ID attributes in
the selector (a), the number of CLASS attributes in the selector (b), and
the number of tag names in the selector (c). Concatenating the three numbers
(in a number system with a large base) gives the specificity. Some examples:
LI            {...}  /* a=0 b=0 c=1 -> specificity =   1 */
UL LI         {...}  /* a=0 b=0 c=2 -> specificity =   2 */
UL OL LI      {...}  /* a=0 b=0 c=3 -> specificity =   3 */        {...}  /* a=0 b=1 c=1 -> specificity =  11 */
UL OL  {...}  /* a=0 b=1 c=3 -> specificity =  13 */
#x34y         {...}  /* a=1 b=0 c=0 -> specificity = 100 */

Pseudo-elements and pseudo-classes are counted as normal elements and
classes, respectively.

so you want to change this

<text style="font-family:Helvetica;font-size:12;" x="160" y="14">Basic


#foo bar { font-family:arial }

<text id="foo" class="bar" style="font-family:Helvetica;font-size:12;"
x="160" y="14">Basic polylines.</text>

to get arial font
instead of this

<text style="font-family:arial;font-size:12;" x="160" y="14">Basic

hmmmmm very logical
>> >If you are worried about maintenence, don't use style attributes.
>> In HTML I would definitely agree with you. HTML documents are
>often made up
>> of many parts images scripts etc so having an external
>stylesheet is not a
>> problem. Most SVGs I have seen are contained in a single file
>Thats because the implementations seem to have a problem with reentrancy of
>their XML parsers, so external symbols etc seem to be a problem. Thats a
>short-term problem though.
>> and I think it
>> is a good idea to keep it that way. If you have to ship around a zip file
>> and/or installation instructions then I think that is not a good thing.
>Well, thats what links are for.

yeh if you are always connected to the internet. If not what options do you
have but to mail somegraphic.SVG + somegraphic.CSS and then instruct them to
save all attachements to the same folder and click on the file with the .SVG
extension. A lot of people don't know how to save attachements nor do they
know that there are such things as file extensions.
>> Would GIF or JPG have become popular if you had to give installation
>> instrictions rather than just clicking on them.
>I don't see the need for URL-fear in this instance, nor do I accept your
>'installation instructions' strawman.

ok so you are saying that it is cool to send someone and SVG that has text
that is red font-family Helvetica when they are connected to the internet
and blue font-family arial when they are offline? That is like saying that
you can send a GIF that is positive if you are connected to the internet and
negative if you are offline.

Ciao Chris

 XSL-List info and archive:

Current Thread