Page 1 of 1

Could Author mode find and use CSS in an attribute?

Posted: Tue Oct 23, 2018 9:28 pm
by martindholmes
Hi there,

Would it be possible to have a configuration in Author Mode whereby, in addition to the supplied CSS stylesheet, the renderer looked for CSS rules in an attribute on XML elements? I'm thinking particularly of the TEI @style attribute, whose contents are CSS. It would be nice if this:

Code: Select all

<p style="text-align: center;">...</p>
showed up as centred in Author Mode because the document type configuration allowed us to specify that @style is a source for CSS rules. It's possible to do this to a certain extent with e.g.:

Code: Select all

*[style='text-align: center;']{text-align: center;}
in the stylesheet, but obviously this gets messy and complicated when multiple rules appear in a single attribute, as is commonly the case.

I'm imagining a configuration in the Document Type dialog box where an XPath selecting one or more attributes could be specified (//*/@style, or */@style if modelled on an xsl:templates/@match attribute). The renderer would then apply rules found in these contexts after applying the general stylesheet rules.

Cheers,
Martin

Re: Could Author mode find and use CSS in an attribute?

Posted: Wed Oct 24, 2018 8:48 am
by Radu
Hi Martin,

We have a special Oxygen CSS property called oxy_styles and it can be used in the CSS something like:

Code: Select all

*[style]{
-oxy-style:attr(style);
}
https://www.oxygenxml.com/doc/versions/ ... perty.html

Maybe the same selector should be added to the default TEI CSSs which come in the TEI framework for Oxygen.

Regards,
Radu

Re: Could Author mode find and use CSS in an attribute?

Posted: Tue Oct 30, 2018 8:07 pm
by martindholmes
Thanks Radu, that's exactly what I need! I must have missed it in the documentation.

I don't know if it belongs in the TEI framework or not; generally @style is used for describing the appearance of an original text rather than styling something for rendering purposes, and it would only be a subset of projects that would want to see those styles in Author mode.

Cheers,
Martin

Re: Could Author mode find and use CSS in an attribute?

Posted: Wed Oct 31, 2018 9:20 am
by Radu
Hi Martin,

Glad this helps you, thanks for the clarification with regard to the @style attribute.

Regards,
Radu