Thanks, Alex, for the suggestions. The part about validation being a separate 
execution thread is useful to know. I think the format of Schematron 
errors/warnings is close enough for this purpose. The main reason for starting 
with CSS was to try matching an earlier (pre-Oxygen) authoring environment 
behavior.

I'll keep the StylesFilter idea in mind in case Schematron does not work out 
for some reason - and also for future tasks where StylesFilter might provide a 
good solution.

Regards,
Amanda


From: oXygen-user [mailto:oxygen-user-boun...@oxygenxml.com] On Behalf Of Alex 
Jitianu
Sent: Monday, March 12, 2018 4:33 AM
To: oxygen-user@oxygenxml.com
Subject: Re: [oXygen-user] CSS background color based on text matches


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).

[cid:image001.png@01D3BA9C.90F387E0]

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<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<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@oxygenxml.com<mailto:oXygen-user@oxygenxml.com>

https://www.oxygenxml.com/mailman/listinfo/oxygen-user<https://www.oxygenxml.com/mailman/listinfo/oxygen-user>

_______________________________________________
oXygen-user mailing list
oXygen-user@oxygenxml.com
https://www.oxygenxml.com/mailman/listinfo/oxygen-user

Reply via email to