dynamic evaluate options of oxy_xpath not working

Having trouble deploying Oxygen XML Web Author? Got a bug to report? Post it all here.
Johann
Posts: 199
Joined: Wed Jun 17, 2015 12:46 pm

dynamic evaluate options of oxy_xpath not working

Post by Johann »

Hello,

We are using Author Web 26.0 version.

In our CSS, we try to use oxy_xpath function with evaluate option at "dynamic" value.

When we insert a fragment that affects the oxy_xpath, the evaluation is not updated. We have to save and refresh the document to see the correct evaluation.

Is there anything special about Author Web that needs to be done or taken into account?

Thank you,

Johann
Bogdan Dumitru
Site Admin
Posts: 142
Joined: Tue Mar 20, 2018 5:28 pm

Re: dynamic evaluate options of oxy_xpath not working

Post by Bogdan Dumitru »

Hello Johann,

Indeed, oxy_xpath support is limited in Web Author. This limitation is documented here: "CSS property values that contain the oxy_xpath function are not updated correctly when the document changes."

But what is your use-case? Maybe we can guide you to something else.
Bogdan Dumitru
http://www.oxygenxml.com
Johann
Posts: 199
Joined: Wed Jun 17, 2015 12:46 pm

Re: dynamic evaluate options of oxy_xpath not working

Post by Johann »

Hello Bogdan,

Indeed, I forgot this limitation.

My use case is quite simple. I have this kind of XML structure:

Code: Select all

<list>
    <item/>
    <item/>
    <item/>
    <item/>
    <item/>
...
</list>
With the CSS, in our display, the list block is collapsed and we display the number of children items thanks to the oxy_xpath function.
We have helpers inside the Author View that enables to add or remove items.
The use of these helpers results in inconsistency in oxy_xpath evalutation.
Operations linked to theses helpers are standard ones: ro.sync.ecss.extensions.commons.operations.InsertFragmentOperation and ro.sync.ecss.extensions.commons.operations.DeleteElementOperation.
We did not develop specific Java Operations.

What de you suggest to workaround this limitation?

Thank you,

Johann
Bogdan Dumitru
Site Admin
Posts: 142
Joined: Tue Mar 20, 2018 5:28 pm

Re: dynamic evaluate options of oxy_xpath not working

Post by Bogdan Dumitru »

Hi,
In that case, maybe you can modify your actions to call at the end a manual refresh that updates the styles:

Code: Select all

authorDocumentModel.getAuthorAccess().getEditorAccess().refresh(nodeToRefresh)
See ro.sync.exml.workspace.api.editor.page.author.WSAuthorEditorPageBase.refresh(AuthorNode): "Refresh the rendering layout and CSS styles for this node and all its contents": https://www.oxygenxml.com/InstData/Edit ... uthorNode)
Bogdan Dumitru
http://www.oxygenxml.com
Johann
Posts: 199
Joined: Wed Jun 17, 2015 12:46 pm

Re: dynamic evaluate options of oxy_xpath not working

Post by Johann »

Hello,


As I said, we do not use specific actions or operations to insert or delete the item elements.
These actions are defined directly in the framework in the externalAuthoractions folder and are not linked to specific Java class on our side:

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<a:authorAction xmlns:a="http://www.oxygenxml.com/ns/author/external-action"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://www.oxygenxml.com/ns/author/external-action http://www.oxygenxml.com/ns/author/external-action/authorAction.xsd"
  id="delete.element">
  <a:name>${i18n(delete.element)}</a:name>
  <a:description>${i18n(delete.element.tooltip)}</a:description>
  <a:operations>
    <a:operation id="DeleteElementOperation">
      <a:arguments/>
    </a:operation>
  </a:operations>
  <a:enabledInReadOnlyContext>false</a:enabledInReadOnlyContext>
</a:authorAction>
Can you explain in more detail how to do this?

Thank you,

Johann
Bogdan Dumitru
Site Admin
Posts: 142
Joined: Tue Mar 20, 2018 5:28 pm

Re: dynamic evaluate options of oxy_xpath not working

Post by Bogdan Dumitru »

Hi,

The "DeleteElementOperation" referenced in your External Author Action is a reference to one of the built-in Author Operations. An Author Operation is an extension of ro.sync.ecss.extensions.api.AuthorOperation.

The only solution for you is to define a custom operation that delegates to DeleteElementOperation and at the end calls ro.sync.exml.workspace.api.editor.page.author.WSAuthorEditorPageBase.refresh(AuthorNode).

See also the Adding a Custom Operation to an Existing Framework topic.
Bogdan Dumitru
http://www.oxygenxml.com
Post Reply