oxygen 11.2 , framework configuration for xpath not working

Oxygen general issues.
guna@ebscohost.com
Posts: 27
Joined: Tue Nov 17, 2009 10:16 pm

oxygen 11.2 , framework configuration for xpath not working

Post by guna@ebscohost.com »

hi i have following xml

Code: Select all


 <front>

<article-meta>

<article-id pub-id-type="IID">RT114449-01</article-id>

<title-group>

<article-title>title - here</article-title>

</title-group>
</article-meta>
</front>
in framework configuration, we have custom framework. inside that we have custom frame work action. and we want this action to execute only if the article-id NOT starts with 'R'

i am trying to do configuration
option, preference, "customframework"(doubleclick), Author Tab, Actions, "selected the action"
then inside that i have following xpath expression

substring(normalize-space(//article-id/text()),1,1) != 'R'

once configuration is done. i tried to execute the action, the action is executing for all article-id, and dose not take the xpath into account.
i also tried
not(//article-id[starts-with (text(),'R')] )

but i could not achieve this. can you guide me?
adrian
Posts: 2855
Joined: Tue May 17, 2005 4:01 pm

Re: oxygen 11.2 , framework configuration for xpath not working

Post by adrian »

Hello,

I think what you're looking for is:

Code: Select all

self::article-id[not(starts-with(text(),'R'))]
This should only execute if the current node is article-id and its next node does not start with 'R'(capital R because starts-with is case sensitive).

Let me know if this works.

Regards,
Adrian
Adrian Buza
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com
Radu
Posts: 9059
Joined: Fri Jul 09, 2004 5:18 pm

Re: oxygen 11.2 , framework configuration for xpath not working

Post by Radu »

Update from the email discussions:

Hi Guna,

For now the only solution I can propose is to execute the operation in an empty XPath context and have the operation execute an XPath when executed to decide what to do:

/**
* @see ro.sync.ecss.extensions.api.AuthorOperation#doOperation(ro.sync.ecss.extensions.api.AuthorAccess, ro.sync.ecss.extensions.api.ArgumentsMap)
*/
public void doOperation(AuthorAccess authorAccess, ArgumentsMap args)
throws IllegalArgumentException, AuthorOperationException {
Object[] nodes = authorAccess.getDocumentController().evaluateXPath("//article-id[(@pub-id-type ='IID') and not(starts-with(text(),'R'))]", false, false, false);
if(nodes != null && nodes.length > 0) {
//Do the operation.
} else {
throw new AuthorOperationException("This is a Review Document");
}
}

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
Post Reply