dynamic link construction for authors
Post here questions and problems related to oXygen frameworks/document types.
dynamic link construction for authors
Dear Developers,
I need an element in author mode to act like a link, but dynamically: if there is an <xref> with @rid inside corresponding to a paragraph @id elsewhere, it should take the author to that paragraph.
Until this moment the paragraphs with the corresponding IDs were in another XML file with a filename that could be predicted from oxy_base-uri(), so that I could easily construct a link with some string functions in the CSS and leave it in place.
But now there is a new complication: if the ID referred to by the xref is present in the current file, the link should lead there; if not, it should be as described earlier (go to another file).
So that what I need is a switch, a test condition looking for a certain ID in the current file, and I have trouble constructing such a switch in the CSS. I considered adding a button which would activate an operation, but there is no author action for moving the caret or linking to another file that would work without additional Java programming.
To be less abstract, here is some pseudo from the CSS:
Is there anything that could be done with this in a relatively inexpensive fashion?
Thank you in advance,
Alexey
I need an element in author mode to act like a link, but dynamically: if there is an <xref> with @rid inside corresponding to a paragraph @id elsewhere, it should take the author to that paragraph.
Until this moment the paragraphs with the corresponding IDs were in another XML file with a filename that could be predicted from oxy_base-uri(), so that I could easily construct a link with some string functions in the CSS and leave it in place.
But now there is a new complication: if the ID referred to by the xref is present in the current file, the link should lead there; if not, it should be as described earlier (go to another file).
So that what I need is a switch, a test condition looking for a certain ID in the current file, and I have trouble constructing such a switch in the CSS. I considered adding a button which would activate an operation, but there is no author action for moving the caret or linking to another file that would work without additional Java programming.
To be less abstract, here is some pseudo from the CSS:
Code: Select all
if (there is an element E in this document whose @id is equal to ./@rid) then
link: .#E (?)
else
link: oxy_concat(oxy_replace(oxy_base-uri(),"_extern",""), "#", attr(id));
end
Thank you in advance,
Alexey
Re: dynamic link construction for authors
Hi Alexey,
With Java extension this could be done using our StylesFilter API:
https://www.oxygenxml.com/doc/versions/ ... ilter.html
Such an API would allow you to provide some kind of CSS layer but control from the Java code what style to set for a certain node.
Without a Java extension, we have a custom CSS function called oxy_xpath:
https://www.oxygenxml.com/doc/versions/ ... ction.html
I have not tested this but the CSS link property would thus have a value something like:
Notice how I use oxy_concat inside of oxy_xpath to be able to call other CSS extension functions and have them expanded before the actual XPath is executed.
The oxy_xpath may induce performance problems, Oxygen does not know exactly on what nodes the selector which uses it depends on so on each modification anywhere in the document Oxygen will refresh the link node. It depends on how much your XML documents can grow, probably if they grow over half a megabyte the problem will be visible to the end user.
Regards,
Radu
With Java extension this could be done using our StylesFilter API:
https://www.oxygenxml.com/doc/versions/ ... ilter.html
Such an API would allow you to provide some kind of CSS layer but control from the Java code what style to set for a certain node.
Without a Java extension, we have a custom CSS function called oxy_xpath:
https://www.oxygenxml.com/doc/versions/ ... ction.html
I have not tested this but the CSS link property would thus have a value something like:
Code: Select all
link:oxy_xpath(oxy_concat("if(//*[@id=", attr(rid), "]) then '#", attr(id), "' else '", oxy_concat(oxy_replace(oxy_base-uri(),"_extern",""), "#", attr(id)), "'"));
The oxy_xpath may induce performance problems, Oxygen does not know exactly on what nodes the selector which uses it depends on so on each modification anywhere in the document Oxygen will refresh the link node. It depends on how much your XML documents can grow, probably if they grow over half a megabyte the problem will be visible to the end user.
Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
<oXygen/> XML Editor
http://www.oxygenxml.com
Return to “SDK-API, Frameworks - Document Types”
Jump to
- Oxygen XML Editor/Author/Developer
- ↳ Feature Request
- ↳ Common Problems
- ↳ DITA (Editing and Publishing DITA Content)
- ↳ SDK-API, Frameworks - Document Types
- ↳ DocBook
- ↳ TEI
- ↳ XHTML
- ↳ Other Issues
- Oxygen XML Web Author
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Content Fusion
- ↳ Feature Request
- ↳ Common Problems
- Oxygen JSON Editor
- ↳ Feature Request
- ↳ Common Problems
- Oxygen PDF Chemistry
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Feedback
- ↳ Feature Request
- ↳ Common Problems
- Oxygen XML WebHelp
- ↳ Feature Request
- ↳ Common Problems
- XML
- ↳ General XML Questions
- ↳ XSLT and FOP
- ↳ XML Schemas
- ↳ XQuery
- NVDL
- ↳ General NVDL Issues
- ↳ oNVDL Related Issues
- XML Services Market
- ↳ Offer a Service