Processing instruction style does not show up in DocBook cus

Oxygen general issues.
xsaero00
Posts: 58
Joined: Sat Aug 01, 2009 12:57 am

Processing instruction style does not show up in DocBook cus

Post by xsaero00 »

I am trying to apply certain style to some professing instructions in my DocBook customization. It does not work. I copied the style directly from Developer's guide.

Code: Select all


@namespace oxy url('http://www.oxygenxml.com/extensions/author');
oxy|processing-instruction {
display:block;
color:purple;
background-color:transparent;
}
The similar style for comment works, but the one for processing instruction does not.

Here is what I am trying to accomplish in the end. I have lots of <?pr-line-feed?> PIs in my source. They need to be converted into line breaks in Author mode. Can this be done with CSS? I was planning on doing something like following:

Code: Select all


oxy|processing-instruction:before {
content: xpath(if name() = pr-line-feed then &#xA; else '');
}
Thanks for all the help.
Radu
Posts: 9446
Joined: Fri Jul 09, 2004 5:18 pm

Re: Processing instruction style does not show up in DocBook cus

Post by Radu »

Hi,

Processing instructions are not shown by default by Oxygen in the Author page.
You can check the "Show Processing Instructions" checkbox from the Oxygen Preferences->Editor / Pages / Author.

After they are shown the first selector described in the Developer guide should work.

There is a problem with the xpath selector for inserting the forced line break due to a bug in Oxygen.

The correct CSS selector construct should be:

Code: Select all


oxy|processing-instruction:before {
content: xpath("if (name() = 'pr-line-feed') then '\A' else ''");
}
But in the current Oxygen version there is a problem interpreting a relative XPath expression when the current node is a PI or CData or an XML comment.
I added a bug to our issues list and a fix for this will probably be available in the next version of Oxygen (probably in September this year).

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
xsaero00
Posts: 58
Joined: Sat Aug 01, 2009 12:57 am

Re: Processing instruction style does not show up in DocBook cus

Post by xsaero00 »

So the relative xpath does not work for processing instructions? It returns document node for current node.

I have something working by doing this:

Code: Select all


oxy|processing-instruction {
display: inline !important;
visibility: visible;
}

oxy|processing-instruction:after {
content: "\A";
}
Another thing I noted that CSS for PIs don't work unless it has "!important" modifier.

Would I be able to implement this properly using StylesFilter or some other API?
Radu
Posts: 9446
Joined: Fri Jul 09, 2004 5:18 pm

Re: Processing instruction style does not show up in DocBook cus

Post by Radu »

Hi,
So the relative xpath does not work for processing instructions? It returns document node for current node.
Exactly. This bug will be fixed in the next released.
Another thing I noted that CSS for PIs don't work unless it has "!important" modifier.
Oxygen contributes with a default CSS to the Author page. The default CSS has the following selector for processing instructions:

Code: Select all


oxy|processing-instruction {
display:block !important;
color: rgb(139, 38, 201) !important;
white-space:pre !important;
border-width:0px !important;
margin:0px !important;
padding: 0px !important;
}
That's why you usually have to specify the !important flag for some properties, to override the ones in the default CSS.
Would I be able to implement this properly using StylesFilter or some other API?
Unfortunately you would not be able to detect the PI content (target and data) using the StylesFilter. Oxygen wraps the PI in a fake element node in order to match correctly the properties in the CSS file. We'll see if we can also improve this aspect.

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
xsaero00
Posts: 58
Joined: Sat Aug 01, 2009 12:57 am

Re: Processing instruction style does not show up in DocBook cus

Post by xsaero00 »

Thanks. Hopefully this will not be a "show stopper".
Radu
Posts: 9446
Joined: Fri Jul 09, 2004 5:18 pm

Re: Processing instruction style does not show up in DocBook cus

Post by Radu »

Hi,

In Oxygen 13 which will be available shortly you will be able to do this either by using the XPath expression discussed above or by implementing our StylesFilter API.

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