gimsieke/epubcheck-xproc

CSS parser: ambiguous rule matches when multiple classes are attached to an element

Closed this issue · 4 comments

err:XTRE0540:Ambiguous rule match for /html/body[1]/div[1]/p[58]
Matches both "[matches(@Class,'(^|\s)foo(\s|$)')]" on line -1 of
and "
[matches(@Class,'(^|\s)bar(\s|$)')]"

Possible solution:
– Don’t write rules for processing elements. Write rules for processing @Class attribute tokens.
– Tokenize each class attribute.
– Process each token

What are the precedence rules for the tokens? The last token’s declarations win? This should translate well to attributes being created by template rules that process each token.

Another consideration: because in XSLT 2, template rules may not be declared to match a string, should css2xsl.xsl create named templates for each token? (<xsl:template name="class-foo">…) Will this capture the different priorities / important declarations?

Why does github capitalize @Class? I entered it lowercase.

mode add-position is not passed at the moment

I included mode="add-position", this solved the ambiguous rule match. Now, the position of each rule inside the css file affects the priority of the generated template.

Great, thanks!