Page 1 of 1

Processing instruction style does not show up in DocBook cus

Posted: Fri Jun 17, 2011 9:19 pm
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.

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

Posted: Mon Jun 20, 2011 4:45 pm
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

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

Posted: Mon Jun 20, 2011 7:15 pm
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?

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

Posted: Tue Jun 21, 2011 8:53 am
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

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

Posted: Tue Jun 21, 2011 7:40 pm
by xsaero00
Thanks. Hopefully this will not be a "show stopper".

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

Posted: Wed Aug 24, 2011 4:36 pm
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