href to a specific node
Having trouble installing Oxygen? Got a bug to report? Post it all here.
-
- Posts: 10
- Joined: Mon Sep 21, 2015 9:52 pm
href to a specific node
I have XML with content in it similar to e.g.
I am trying to link to this from another XML document which has XML like:
I use CSS 'content' with 'oxy_xpath' to display the data from the other document inside the xr when using Author mode, this works great.
Now I want to have oXygen Author mode actually take the user to the target when clicking in the content.
I've added the following CSS which correctly takes the user to the right document:
However I can't figure out how to take them to the right place in the document:
I can't find any proper documentation on what oXygen can do with hrefs in terms of extra data coming after '#' or '?' so I've tried e.g.:
and:
and various other combinations but can't get anything to work.
Is there some way to achieve this?
Code: Select all
<Node rid="C10024">...</Node>
Code: Select all
<xr refdoc="foo.xml" ref="C10024"></xr>
Now I want to have oXygen Author mode actually take the user to the target when clicking in the content.
I've added the following CSS which correctly takes the user to the right document:
Code: Select all
link: oxy_xpath("@refdoc");
I can't find any proper documentation on what oXygen can do with hrefs in terms of extra data coming after '#' or '?' so I've tried e.g.:
Code: Select all
link: oxy_concat(oxy_xpath("@refdoc"),"#",attr(ref));
Code: Select all
link: oxy_concat(oxy_xpath("@refdoc"),"?rid=",attr(ref));
Is there some way to achieve this?
-
- Posts: 1016
- Joined: Wed Nov 16, 2005 11:11 am
Re: href to a specific node
Post by alex_jitianu »
Hello,
The default implementation for locating elements works with:
- ID scheme: file:/.../foo.xml#my_id
- XInclude element scheme : element(/1/2)
That being said, if @rid is is declared as having ID type then you can use this rule:
If @rid is not declared is not an ID then you can use the XInclude element scheme, like this:
Best regards,
Alex
The default implementation for locating elements works with:
- ID scheme: file:/.../foo.xml#my_id
- XInclude element scheme : element(/1/2)
That being said, if @rid is is declared as having ID type then you can use this rule:
Code: Select all
xr {
link: oxy_url(attr(refdoc)) "#" attr(ref);
content: attr(ref);
}
Code: Select all
xr {
link: oxy_url(attr(refdoc)) "#" "element("
oxy_xpath( oxy_concat("concat('/', string-join(for $node in (doc('", oxy_url(attr(refdoc)), "')//*:Node[@rid='", attr(ref), "'])[1]/ancestor-or-self::* return xs:string(count($node/preceding-sibling::*) + 1), '/'))" ) )
")";
content: attr(ref);
}
Alex
-
- Posts: 10
- Joined: Mon Sep 21, 2015 9:52 pm
Re: href to a specific node
Note - I don't know if this is an oXygen bug or something else, but if the target document is not already open in Author mode then the part after the # does not work (i.e. it doesn't scroll to the correct place) - if trying a second time (once the target document is already open in Author mode) then it works as expected.
-
- Posts: 1016
- Joined: Wed Nov 16, 2005 11:11 am
Re: href to a specific node
Post by alex_jitianu »
Hello,
Strange. I've tested myself on some sample files and in my case the node was selected no matter if the target file was already open or not. If you contact us on email support@oxygenxml.com I can send you some samples of mine and perhaps you can also send me some samples to reproduce the behavior.
Best regards,
Alex
Strange. I've tested myself on some sample files and in my case the node was selected no matter if the target file was already open or not. If you contact us on email support@oxygenxml.com I can send you some samples of mine and perhaps you can also send me some samples to reproduce the behavior.
Best regards,
Alex
-
- Posts: 10
- Joined: Mon Sep 21, 2015 9:52 pm
Re: href to a specific node
Unfortunately I've run into some other limitations when trying to use xs:ID so I am trying now the second approach (Xinclude) I get the following error when clicking on the link.
Code: Select all
The application detected an error that is not automatically handled. It is possible that this error is not critical and the application may continue to work normally but our recommendation is to report the error and restart the application. If the application has become unstable and cannot be closed normally, you can use the Force Quit button from this dialog. Be aware that by doing this you will lose all unsaved changes in the opened documents.
Here are the error details:
[ Link opener: C:\Users\m\Desktop\AWS\Import\Output\5.xml ] - java.lang.ArrayIndexOutOfBoundsException: 0
java.lang.ArrayIndexOutOfBoundsException: 0
at ro.sync.ecss.extensions.commons.XPointerElementLocator.<init>(Unknown Source)
at ro.sync.ecss.extensions.commons.DefaultElementLocatorProvider.getElementLocator(Unknown Source)
at ro.sync.exml.editor.xmleditor.sb.goToReferenceInternal(Unknown Source)
at ro.sync.exml.editor.nc.goToReference(Unknown Source)
at ro.sync.exml.editor.nd.icl(Unknown Source)
at ro.sync.exml.editor.nd.ael(Unknown Source)
at ro.sync.exml.editor.nd.open(Unknown Source)
at ro.sync.exml.e.v.c(Unknown Source)
at ro.sync.exml.e.v.d(Unknown Source)
at ro.sync.exml.editor.xmleditor.pageauthor.p.open(Unknown Source)
at ro.sync.exml.editor.b.c.v$1.szc(Unknown Source)
at ro.sync.ui.application.kb.run(Unknown Source)
at ro.sync.ui.application.kb.start(Unknown Source)
at ro.sync.exml.editor.b.c.v.g(Unknown Source)
at ro.sync.ecss.component.h.k.c(Unknown Source)
at ro.sync.ecss.component.n.mouseEvent(Unknown Source)
at ro.sync.exml.view.l$2.mouseClicked(Unknown Source)
at java.awt.AWTEventMulticaster.mouseClicked(Unknown Source)
at java.awt.AWTEventMulticaster.mouseClicked(Unknown Source)
at java.awt.AWTEventMulticaster.mouseClicked(Unknown Source)
at java.awt.AWTEventMulticaster.mouseClicked(Unknown Source)
at java.awt.Component.processMouseEvent(Unknown Source)
at javax.swing.JComponent.processMouseEvent(Unknown Source)
at java.awt.Component.processEvent(Unknown Source)
at java.awt.Container.processEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Window.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
at java.awt.EventQueue.access$500(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
at java.awt.EventQueue$4.run(Unknown Source)
at java.awt.EventQueue$4.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)
-
- Posts: 10
- Joined: Mon Sep 21, 2015 9:52 pm
Re: href to a specific node
Another question:
This slows the program to a crawl (and eventually shows an out of memory exception) if refdoc is not yet set (when inserting a new blank Node) - is there a way to not have the link evaluated unless the content is not empty or something similar to avoid this?
Code: Select all
link: oxy_url(attr(refdoc)) "#" "element("
oxy_xpath( oxy_concat("concat('/', string-join(for $node in (doc('", oxy_url(attr(refdoc)), "')//*:Node[@rid='", attr(ref), "'])[1]/ancestor-or-self::* return xs:string(count($node/preceding-sibling::*) + 1), '/'))" ) )
")";
-
- Posts: 1016
- Joined: Wed Nov 16, 2005 11:11 am
Re: href to a specific node
Post by alex_jitianu »
Hello,
Quite an unexpected behavior...but if you say the situation happens only when @refdoc is not set (or empty) you can filter this particular situation through the CSS selector:
If you still get the slow and OutOfMemory, perhaps you can send us some samples on support@oxygenxml.com
Best regards,
Alex
Quite an unexpected behavior...but if you say the situation happens only when @refdoc is not set (or empty) you can filter this particular situation through the CSS selector:
Code: Select all
xr[refdoc]:not([refdoc=""]) {
link: oxy_url(attr(refdoc)) "#" "element("
oxy_xpath( oxy_concat("concat('/', string-join(for $node in (doc('", oxy_url(attr(refdoc)), "')//*:Node[@rid='", attr(ref), "'])[1]/ancestor-or-self::* return xs:string(count($node/preceding-sibling::*) + 1), '/'))" ) )
")";
content: attr(ref);
}
Best regards,
Alex
Jump to
- Oxygen XML Editor/Author/Developer
- ↳ Feature Request
- ↳ Common Problems
- ↳ DITA (Editing and Publishing DITA Content)
- ↳ Artificial Intelligence (AI Positron Assistant add-on)
- ↳ 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