[oXygen-user] CSS background color based on text matches

Alex Jitianu alex_jitianu at sync.ro
Mon Mar 12 03:32:58 CDT 2018


Dear Amanda,

Using Schematron for validating these requirements is indeed a better 
approach because the validation is done on a separate execution thread 
and doesn't affect the layout.When a rule is broken, the visual 
indicator is a squiggly yellow line (or red, if you want to mark it as 
an error) which is pretty close to the way you are currently marking the 
element in the CSS rule (a yellow background).

A CSS rule will give you more options on how to mark the error: colors, 
borders etc. Do you find the Schematron error marking (the yellow 
squiggly underline) enough or you would prefer to be able to change it 
to something else?

Another option would be to use our Java based API and set a StylesFilter 
[1] and change the background color from there. In such an extension 
point you can directly navigate the author node model which is faster 
than executing an XPath.

[1] 
https://www.oxygenxml.com/doc/versions/19.1/ug-editor/topics/dg-author-css-styles-filter.html

Best regards,
Alex
-- 
Alex Jitianu
<oXygen/>  XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com

On 3/9/2018 8:47 PM, Amanda Galtman wrote:
>
> Hi,
>
> We’ve had a request from an author to make the formatting in the 
> Author view indicate when the text of a certain element type does not 
> match the text of something else found inside the same topic. I can do 
> this via Oxygen CSS, but I am concerned that the processing slows down 
> the opening of large documents. I’m not convinced that CSS is a good 
> way to address the underlying requirement about helping authors detect 
> when something does not have a textual match as expected (e.g., maybe 
> Schematron or a build warning would be more appropriate).
>
> Before I give up, though, I wanted to see if anyone had specific ideas 
> or techniques I might have overlooked.
>
> Here’s an example of variations I tried that work too slowly in large 
> documents, just to give you the flavor.
>
> /* true => 255*1 => white
> * false => 255*0 => yellow */
> refentry[role="function"]literal{
> background-color:oxy_xpath(
> "concat('rgb(255,255,', 255 * number(. = ancestor::refentry//term or 
> .='') , ')')",
> evaluate,dynamic-once);
> }
>
> Alternate:
>
> refentry[role="function"]literal{
> background-color:oxy_xpath(
> "if (exists(text()) and not(some $n in 
> ancestor::refentry/refsect1[@role=('inputs','outputs')]//term 
> satisfies string($n)=.)) then ('yellow') else ('')",
> evaluate,dynamic-once);
> }
>
> Thanks,
>
> Amanda
>
>
>
> _______________________________________________
> oXygen-user mailing list
> oXygen-user at oxygenxml.com
> https://www.oxygenxml.com/mailman/listinfo/oxygen-user

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.oxygenxml.com/pipermail/oxygen-user/attachments/20180312/96424029/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: jlgianmenhjdgchf.png
Type: image/png
Size: 830 bytes
Desc: not available
URL: <http://www.oxygenxml.com/pipermail/oxygen-user/attachments/20180312/96424029/attachment.png>


More information about the oXygen-user mailing list