Search code examples
cssxmlprint-cssantenna-house

Class and id selectors not working in AntennaHouse Formatter


I am new to Print CSS and am working on a template for an XML document, using AH Formatter Lite V6.6. I cannot get class selectors to work.

For example, source snippet:

<section class="meta_Materials_(Structured)">
    <title>Materials</title>
    <para class="Body_Text">None.</para>
</section>

And template snippet:

.Body_Text{
    font-family:'HelveticaNeueLT Std LT';
    font-size:8.5pt;
    line-height:12pt;
    font-weight:300;
    font-style:normal;
    color: black;
}

... have no effect whatsoever.

The same applies to id selectors. I validated the template (passed), tried all sorts of equivalent selectors (para.Body_Text, section para.Body_Text, section > para.Body_Text), to no avail.

I cannot select any class or id anywhere in the document, though I can select elements.

What gives?


Solution

  • When the source document is XML, rather than HTML or XHTML, there is nothing special about the class attribute. To use the class attribute, you have to match on it or its value, just as you would for any other attribute:

    *[class ~= "Body_Text"] {
        font-family:'HelveticaNeueLT Std LT';
        font-size:8.5pt;
        line-height:12pt;
        font-weight:300;
        font-style:normal;
        color: red;
    }