Author mode css styling

Questions about XML that are not covered by the other forums should go here.
sljohns
Posts: 13
Joined: Wed Mar 01, 2023 5:45 pm

Author mode css styling

Post by sljohns »

I have an element that references other elements via the attribute <internalRef internalRefId=""/>. I want to return the name/text() of the matching @id. My css is below. If i specifically state the @internalRefId ( oxy_link-text(oxy_xpath("//*[@id = 'sup-0001']/name/text()"));), i get a value. But obviously it will return the same name for all internalRef. Can this be done?

Code: Select all

internalRef:before {
  -oxy-link:oxy_concat('#',attr(internalRefId));
    color : #000080 ; 
    content : url("../img/link.png") 
    ""
    oxy_combobox(edit, "@internalRefId", columns, 10)
    oxy_link-text(oxy_xpath("//*[@id = @internalRefId]/name/text()"));
     
    font-size : 16px ; 
    font-style : normal ; 
    font-weight : 400 ; 
    line-height : 120.00001% ; 
    text-decoration-color : #000080 ; 
    text-decoration-line : underline ; 
    text-decoration-style : solid ; 
     
  }
Radu
Posts: 9431
Joined: Fri Jul 09, 2004 5:18 pm

Re: Author mode css styling

Post by Radu »

Hi,
The oxy_link-text() CSS function in general receives no parameter:
https://www.oxygenxml.com/doc/versions/ ... -text.html
It gets expanded usually by a specific Java extension placed in the framework configuration, like for example we have such implementations for DITA and DocBook:
https://www.oxygenxml.com/InstData/Edit ... olver.html
https://www.oxygenxml.com/doc/versions/ ... undle.html

Such resolvers are useful because we do not really want to use oxy_xpath in the CSSs we ship for DITA and DocBook as the oxy_xpath may induce performance problems when working with large documents.
https://www.oxygenxml.com/doc/versions/ ... ction.html

Anyway, coming back to your CSS code, it could be changed something like this:

Code: Select all

internalRef:before {
-oxy-link:oxy_concat('#',attr(internalRefId));
color : #000080 ;
content : url("../img/link.png")
""
oxy_combobox(edit, "@internalRefId", columns, 10)
oxy_xpath(oxy_concat("//*[@id =",  attr(internalRefId), "]/name/text()"));

...

}
So in this case I used oxy_concat inside of oxy_xpath in order to expand the literal attribute value of the current element in the XPath expression. I did not test this but I think as another workaround the XPath can also be written I think by using a "let" expression to save the current value of @internalRefId and then use that value further like:

Code: Select all

oxy_xpath("let $abc := @internalRefId return //*[@id = $abc]/name/text()")

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
sljohns
Posts: 13
Joined: Wed Mar 01, 2023 5:45 pm

Re: Author mode css styling

Post by sljohns »

The let expression worked like a charm! Thanks @radu
Post Reply