dynamic link construction for authors
Posted: Fri Jan 27, 2017 12:07 pm
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