[daisy] finer control over styling of included documents

Karel Vervaeke karel at outerthought.org
Thu Apr 3 09:45:25 CEST 2008


For this we usually depend on css, here are a few specific approaches
(pick one that matches your situation)

1. Different styling depending on the type of the including document.
Here we have three document types ("typeA", "typeB", "typeC") and three
documents (A, B, C of the corresponding type)

C is the document that is included (once by 'A' and once by 'B').

In the document styling of type[ABC], slap a div tag around the contents
with a class attribute that corresponds to the documenttype (say,
typeAContent, typeBContent, typeCContent.

Next, in layout.xsl you can do something like this:

.typeAContent .typeCContent {
  background: "#f0f"; /* magic pink */
}

.typeBContent .typeCContent {
  background: #ff0; /* yellow */
}

If you can't solve it with css styling alone, you can always render
typeC twice, once using @class="typeCforTypeA" and once using
@class="typeCinTypeB", next use 

.typeAContent .typeCinTypeB {
  display: none;
}

typeBContent .typeCinTypeA {
  display: none;
}

(However this is ugly, since you would send the same content twice
everytype typeC is include.  A lot can be done with smart use of CSS on
a single copy)

2.  You can also have different styles based on fields on the document
(this way you can have two instances of 'typeA', but let the styling
depend on the value of the field).  I would not encourage this approach:
my experience is that things quickly become complicated this way.

3. Styling a single-include different from a query-include is not
possible to the best of my knowledge, sorry.

HTH,
Karel

ps: we know that something like style_hint would be nice for includes,
we simply never got around to solving this because the css approach has
(so far) always worked ;-) (well that, and it not an easy problem)

On Wed, 2008-04-02 at 19:22 -0400, cajaygle wrote:
> Hi, I'm wondering if there's a way to have finer control of the  
> styling of included documents.  Currently we have customized our  
> document styling to take into account the isIncluded attribute,  
> however, that only allows us to have a single style for included  
> documents.  Ideally, I'm looking for a way for the including document  
> to control the style of included documents, for both query-includes  
> and single includes -- something akin to style_hint that is possible  
> on regular queries.  Alternatively, is there any way that I could  
> style a single included document differently than when multiple  
> documents are included?
> 
> Thanks,
> 
> Jay
> _______________________________________________
> daisy community mailing list
> Professional Daisy support: http://outerthought.org/en/services/daisy/support.html
> mail to: daisy at lists.cocoondev.org
> list information: http://lists.cocoondev.org/mailman/listinfo/daisy


More information about the daisy mailing list