Page 1 of 1

Get Attribute Value from Bookmeta node

Posted: Thu May 06, 2021 4:18 pm
by nagang
Hi All,

I want to get the attribute values in bookmeta node such as Doc number and Revision. Its essential for my requirement.
Please let me know how I can proceed.

Regards,
Vivek.

Re: Get Attribute Value from Bookmeta node

Posted: Fri May 07, 2021 7:58 am
by Radu
Hi Vivek,

Maybe you can give more details, is this for editing, is this for publishing? If it's publishing to what output format is it? If it's PDF publishing, do you publish using our CSS-based processor or the classic XSL-FO processor?
Is your question related to an XSLT customization where you attempt to retrieve information from the bookmeta element? If so what have you tried so far?

Regards,
Radu

Re: Get Attribute Value from Bookmeta node

Posted: Fri May 07, 2021 8:12 am
by nagang
Hi Radu,

It's not for either of them. I want it for making a rest api call based on the bookmap opened in the editor. I have tried with select node and get the attribute values but with no success. Also that will not be suitable for my requirement as I need to get the details of the bookmap as soon as the bookmap is loaded in the editor.

Any help is appreciated.

Regards,
Vivek.

Re: Get Attribute Value from Bookmeta node

Posted: Fri May 07, 2021 8:30 am
by Radu
Hi,

If you already have a workspace access plugin for Oxygen, maybe you can evaluate an XPath expression after an XML document is opened, something like:

Code: Select all

    @Override
    public void applicationStarted(StandalonePluginWorkspace pluginWorkspaceAccess) {
      pluginWorkspaceAccess.addEditorChangeListener(new WSEditorChangeListener() {
        public void editorOpened(URL editorLocation) {
          WSEditor editorAccess = pluginWorkspaceAccess.getEditorAccess(editorLocation, PluginWorkspace.MAIN_EDITING_AREA);
          WSEditorPage currentPage = editorAccess.getCurrentPage();
          if(currentPage instanceof WSAuthorEditorPage) {
            WSAuthorEditorPage authorPage = (WSAuthorEditorPage) currentPage;
            try {
              Object[] result = authorPage.getDocumentController().evaluateXPath("//bookmeta/*/@someattribute", false, false, false);
            } catch (AuthorOperationException e) {
              // TODO Auto-generated catch block
              e.printStackTrace();
            }
          }
        };
      }, PluginWorkspace.MAIN_EDITING_AREA);
    }
Regards,
Radu

Re: Get Attribute Value from Bookmeta node

Posted: Fri May 07, 2021 8:46 am
by nagang
Hi Radu,

I forgot to mention that I need this in Oxygen Web Author as well. I have workspace access plugin in Web. Please add the details for that.

Thank You,

Regards,
Vivek.

Re: Get Attribute Value from Bookmeta node

Posted: Fri May 07, 2021 9:37 am
by mihai_coanda
Hello,

The approach Radu suggested also works for Oxygen XML Web Author.

Regards,
Michael