cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Have a PTC product question you need answered fast? Chances are someone has asked it before. Learn about the community search. X

How can I use an ACL code inside the APP?

rboneti
1-Newbie

How can I use an ACL code inside the APP?

Hi all,

I need to use a acl code inside the APP code, and save the informations that the ACL retrieves in a variable.

5 REPLIES 5

Hi Robson,

ACL code is an Arbortext Editor language and won't execute inside of APP code. If you need to pass variable information between the 2 applications, I would use Javascript or Perl which are 2 languages that both applications support.

Out of curiosity, what information are you trying to pass from APP and to where?

-Jeff

Hi Jeff,

Actually, I could do it with this:

formatting.evaluateXPath("_acl:eval(here the acl code)")

But would be better if was possible to do this without xpath.

Answaring your question, I want to save a value in a variable and use in another element, like a global variable. And for this, I've found two ways:

application.variables and the acl ENV['name']

That's a neat trick, but we have noticed with newer APP (Arbortext) releases that formatting.evaluateXPath() will now only work in a formatting context. That is to say, if try and run a script with that method it won't work. If you run that method from within a formatting tag then it will still work.

Either way, while I like your trick I'm not sure it is the best way to pass information between Arbortext/APP. It feels like that would be something liable to change or break between APP/Arbortext releases. It would be interesting to learn what you are trying to achieve in order to advise if there is a better way.

Gareth,

Using the xPath it works, I can save a value with the command ENV['test'] = "value" and retrieve this value calling the ENV with the same name. I've tested this in Gentext.

In APP JS variables can be initialised 'global' and reused later with things like:
var global = {};
or
template.globalVar1 = 'foo';

But for XPath tests when NOT formatting you can use something like this in JS:

var stream = template.content.getStream('mainText');

//'mainText' would be the standard editorDOM from styler i'd guess

var tree = stream.xmlDocument;

var result = tree.evaluateXpath(stuff...);

But presumably your coding this from Styler and source edits not APP GUI?

Regards

Chris

Top Tags