Martin Kolar?k wrote:
> 
> I have DTD which contains a lot of elements with underscore in name. I have
> difficulties to define CSS for these elements -- XXE (its CSS parser)
> reports an error, if such name occurs. What to do with it? A name with
> underscore are quite usual.

This is an excerpt of the grammar of CSS2:

-----------------------------------------------------------------
      selector
        : simple_selector [ combinator simple_selector ]*
        ;
      simple_selector
        : element_name? [ HASH | class | attrib | pseudo ]* S*
        ;
      class
        : '.' IDENT
        ;
      element_name
        : IDENT | '*'
        ;
                    .
                    .
                    .
      nmstart         [a-z]|{nonascii}|{escape}
      nmchar          [a-z0-9-]|{nonascii}|{escape}
      string1         \"([\t !#$%&(-~]|\\{nl}|\'|{nonascii}|{escape})*\"
      string2         \'([\t !#$%&(-~]|\\{nl}|\"|{nonascii}|{escape})*\'

      ident           {nmstart}{nmchar}*
                    .
                    .
                    .
      {ident}                 {return IDENT;}
------------------------------------------------------------------

You can notice that IDENT cannot contain a '_' unless this character is
escaped.

The answer is therefore: escape the underscore. Example: instead of
writing foo_bar in the CSS, write foo\_bar.

Reply via email to