Problem with ${xpath_eval(parent::node()/@id)}
Having trouble deploying Oxygen XML Web Author? Got a bug to report? Post it all here.
-
- Posts: 43
- Joined: Thu Feb 16, 2023 11:00 pm
Problem with ${xpath_eval(parent::node()/@id)}
Good afternoon!
We are having a problem with xpath_eval, when passing xPath "/*/@id" the system correctly returns the @id of the first element of the XML, however when we pass "parent::node()/@id" the system returns nothing .
We are using :
${xpath_eval(parent::node()/@id)}-${uuid}
Can you tell us if the way to collect the ID of the relative node is correct?
We have tested the "parent::node()/@id" statement in Oxygen Desktop and it is working correctly. The problem is with Oxygen Web.
We are having a problem with xpath_eval, when passing xPath "/*/@id" the system correctly returns the @id of the first element of the XML, however when we pass "parent::node()/@id" the system returns nothing .
We are using :
${xpath_eval(parent::node()/@id)}-${uuid}
Can you tell us if the way to collect the ID of the relative node is correct?
We have tested the "parent::node()/@id" statement in Oxygen Desktop and it is working correctly. The problem is with Oxygen Web.
-
- Posts: 1
- Joined: Thu May 23, 2024 7:25 am
- Location: https://hackerdna.com
- Contact:
Re: Problem with ${xpath_eval(parent::node()/@id)}
Hello,
Your problem reminds me of an old hacker trick. In Oxygen Desktop, the instruction works because the desktop environment has a more robust and tolerant implementation. Make sure the context of the current node is set correctly before using "parent::node()/@id". If the context is incorrect, the evaluation won't work. Here's a hacker's tip: try to isolate the problem by testing different contexts, or by checking whether updates or patches are available for Oxygen Web.
Your problem reminds me of an old hacker trick. In Oxygen Desktop, the instruction works because the desktop environment has a more robust and tolerant implementation. Make sure the context of the current node is set correctly before using "parent::node()/@id". If the context is incorrect, the evaluation won't work. Here's a hacker's tip: try to isolate the problem by testing different contexts, or by checking whether updates or patches are available for Oxygen Web.
-
- Posts: 517
- Joined: Thu Sep 04, 2014 4:22 pm
Re: Problem with ${xpath_eval(parent::node()/@id)}
Post by cristi_talau »
Hello,
Can you share in what context you are using the xpath_eval environment variable? Is it passed as an argument to an AuthorOperation inside an Action? Something else?
Best,
Cristian
Can you share in what context you are using the xpath_eval environment variable? Is it passed as an argument to an AuthorOperation inside an Action? Something else?
Best,
Cristian
-
- Posts: 43
- Joined: Thu Feb 16, 2023 11:00 pm
Re: Problem with ${xpath_eval(parent::node()/@id)}
Hello!
We create an UniqueAttributesRecognizer and call GenerateIDElementsInfo.generateID() passing "idGenerationPattern", "AuthorElement element", "Editor Location".
And received this log:
//Working using ${xpath_eval(/*/@id)}
ERROR idGenerationPattern > before ${xpath_eval(/*/@id)}-ZID-${uuid}
ERROR element.getLocalName() > zoneIdent
ERROR edLocation.toString() > webdav-http://****@******/zoneS1000D.xml
ERROR idGenerationPattern > after ZON-0000000040-ZID-af696d1f-49aa-4dc9-b3d5-6701335e776b
//Not working using ${xpath_eval(parent::node()/@id)}-gra
ERROR idGenerationPattern > before ${xpath_eval(parent::node()/@id)}-gra
ERROR element.getLocalName() > before graphic
ERROR edLocation.toString() > webdav-http://****@*****/zoneS1000D.xml
ERROR idGenerationPattern > after -gra
//Not working using ${xpath_eval(./parent::node()/@id)}-hot
ERROR idGenerationPattern > before ${xpath_eval(./parent::node()/@id)}-hot
ERROR element.getLocalName() > hotspot
ERROR edLocation.toString() > webdav-http://****@*****/zoneS1000D.xml
ERROR idGenerationPattern > after -hot
Tried:
./parent::node()/@id
parent::node()/@id
/parent::node()/@id
./parent::*/@id
parent:*/@id
./ancestor::node()[1]/@id
We create an UniqueAttributesRecognizer and call GenerateIDElementsInfo.generateID() passing "idGenerationPattern", "AuthorElement element", "Editor Location".
Code: Select all
/** Using AuthorElement element
*
*/
logger.error("idGenerationPattern > before " + idGenerationPattern);
logger.error("element.getLocalName() > " + element.getLocalName());
logger.error("edLocation.toString() > " + edLocation.toString());
// primeiramente crio o ID que contiver xpath evaluation
idGenerationPattern = GenerateIDElementsInfo.generateID(idGenerationPattern, element.getLocalName(),
edLocation != null ? edLocation.toString() : null);
logger.error("idGenerationPattern > after " + idGenerationPattern);
//Working using ${xpath_eval(/*/@id)}
ERROR idGenerationPattern > before ${xpath_eval(/*/@id)}-ZID-${uuid}
ERROR element.getLocalName() > zoneIdent
ERROR edLocation.toString() > webdav-http://****@******/zoneS1000D.xml
ERROR idGenerationPattern > after ZON-0000000040-ZID-af696d1f-49aa-4dc9-b3d5-6701335e776b
//Not working using ${xpath_eval(parent::node()/@id)}-gra
ERROR idGenerationPattern > before ${xpath_eval(parent::node()/@id)}-gra
ERROR element.getLocalName() > before graphic
ERROR edLocation.toString() > webdav-http://****@*****/zoneS1000D.xml
ERROR idGenerationPattern > after -gra
//Not working using ${xpath_eval(./parent::node()/@id)}-hot
ERROR idGenerationPattern > before ${xpath_eval(./parent::node()/@id)}-hot
ERROR element.getLocalName() > hotspot
ERROR edLocation.toString() > webdav-http://****@*****/zoneS1000D.xml
ERROR idGenerationPattern > after -hot
Tried:
./parent::node()/@id
parent::node()/@id
/parent::node()/@id
./parent::*/@id
parent:*/@id
./ancestor::node()[1]/@id
Last edited by aujunior on Thu May 23, 2024 6:39 pm, edited 1 time in total.
-
- Posts: 517
- Joined: Thu Sep 04, 2014 4:22 pm
Re: Problem with ${xpath_eval(parent::node()/@id)}
Post by cristi_talau »
Hello,
This is a limitation of GenerateIDElementsInfo.generateID - it does not know where the selection is in the editor. In the desktop application, it is easier to determine since there is only one user, and only one editor open. In Web Author we fixed a similar problem (reference ID WA-6789) and the fix will be in the next release. If you can send us a framework such that we can reproduce the problem, we can confirm if it is fixed in the next release.
Another option is to use Java code to find the desired ID instead of relying on GenerateIDElementsInfo.generateID. For example, you can use AuthorDocumentController.findNodesByXPath or evaluateXPath.
Best,
Cristian
This is a limitation of GenerateIDElementsInfo.generateID - it does not know where the selection is in the editor. In the desktop application, it is easier to determine since there is only one user, and only one editor open. In Web Author we fixed a similar problem (reference ID WA-6789) and the fix will be in the next release. If you can send us a framework such that we can reproduce the problem, we can confirm if it is fixed in the next release.
Another option is to use Java code to find the desired ID instead of relying on GenerateIDElementsInfo.generateID. For example, you can use AuthorDocumentController.findNodesByXPath or evaluateXPath.
Best,
Cristian
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