Could Author mode find and use CSS in an attribute?

Are you missing a feature? Request it's implementation here.
martindholmes
Posts: 139
Joined: Wed Apr 20, 2005 5:43 pm
Location: Victoria, BC, Canada

Could Author mode find and use CSS in an attribute?

Post by martindholmes » Tue Oct 23, 2018 9:28 pm

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

Radu
Posts: 6326
Joined: Fri Jul 09, 2004 5:18 pm

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

Post by Radu » Wed Oct 24, 2018 8:48 am

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
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com

martindholmes
Posts: 139
Joined: Wed Apr 20, 2005 5:43 pm
Location: Victoria, BC, Canada

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

Post by martindholmes » Tue Oct 30, 2018 8:07 pm

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

Radu
Posts: 6326
Joined: Fri Jul 09, 2004 5:18 pm

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

Post by Radu » Wed Oct 31, 2018 9:20 am

Hi Martin,

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

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com

Post Reply