Get Attribute Value from Bookmeta node

Having trouble deploying Oxygen XML Web Author? Got a bug to report? Post it all here.
nagang
Posts: 37
Joined: Mon Jul 14, 2014 9:48 am

Get Attribute Value from Bookmeta node

Post 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.
Radu
Posts: 9051
Joined: Fri Jul 09, 2004 5:18 pm

Re: Get Attribute Value from Bookmeta node

Post 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
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
nagang
Posts: 37
Joined: Mon Jul 14, 2014 9:48 am

Re: Get Attribute Value from Bookmeta node

Post 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.
Radu
Posts: 9051
Joined: Fri Jul 09, 2004 5:18 pm

Re: Get Attribute Value from Bookmeta node

Post 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
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
nagang
Posts: 37
Joined: Mon Jul 14, 2014 9:48 am

Re: Get Attribute Value from Bookmeta node

Post 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.
mihai_coanda
Posts: 78
Joined: Wed Jul 20, 2016 8:22 am

Re: Get Attribute Value from Bookmeta node

Post by mihai_coanda »

Hello,

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

Regards,
Michael
Michael

https://www.oxygenxml.com
Post Reply