Page 1 of 1

oxygen 11.2 , framework configuration for xpath not working

Posted: Thu Mar 18, 2010 10:14 pm
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?

Re: oxygen 11.2 , framework configuration for xpath not working

Posted: Fri Mar 19, 2010 4:38 pm
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

Re: oxygen 11.2 , framework configuration for xpath not working

Posted: Wed Mar 24, 2010 10:40 am
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