Page 1 of 1

Switch Variables in XML Location Path

Posted: Mon Mar 26, 2018 12:06 pm
by numnational
Hi all,

I must have a variable in my XML location Path, is it possible ?

When i test it with '6' all is ok and it work like i want, but if this value is in variable, it have an error.

This work :
[Metadata.Text:Path="/contexture/publication/parution/cahier/pages/page[@folio='6']/@verrou",Dataset="SYELA-XML",Model="XML"]
https://www.dropbox.com/s/sgwijeqzh1pq9 ... 6.png?dl=0

Here i just remplaced the value '6' by my variable '[Job.PrivateData:Key="FOLIO"]' and This don't work :
[Metadata.Text:Path="/contexture/publication/parution/cahier/pages/page[@folio='[Job.PrivateData:Key="FOLIO"]']/@verrou",Dataset="SYELA-XML",Model="XML"]
https://www.dropbox.com/s/gnfqyggd9297d ... 1.png?dl=0

Any idea please ???? thanks.

Re: Switch Variables in XML Location Path

Posted: Mon Mar 26, 2018 12:35 pm
by jan_suhr
Try escaping the square brackets around your variable like \[Job.PrivateData:Key="FOLIO"\]. Switch is picky when it comes to square brackets.

Re: Switch Variables in XML Location Path

Posted: Mon Mar 26, 2018 1:19 pm
by numnational
Thanks for your answer but i have the same error...

Re: Switch Variables in XML Location Path

Posted: Mon Mar 26, 2018 3:53 pm
by jan_suhr
As I said brackets is something Switch is picky about.

This is from the manual:
If used in an argument that supports nested variables, the opening square bracket '[' is interpreted by Switch as the beginning of a new variable. To use the square bracket as static text, you need to double it: '[['. Note that there is no need to double the closing square bracket.
But nested variables are not supported in all variable groups.

Re: Switch Variables in XML Location Path

Posted: Mon Mar 26, 2018 4:07 pm
by numnational
Answer from enfocus support... Grrrr

Hi Boris,

It's not possible to use Switch Variables in an XML location path. Switch currently does not convert nested variables in XML. You can find more info on this here: http://www.enfocus.com/manuals/UserGuid ... yntax.html

Kind regards,
Jan De Brabanter

Enfocus Product Specialist

Re: Switch Variables in XML Location Path

Posted: Thu Mar 29, 2018 6:49 pm
by allsystems
If you have the scripting module, try this as a script expression...

var theFolio = job.getPrivateData("FOLIO");
var xpathString = "[Metadata.Text:Path=\"/contexture/publication/parution/cahier/pages/page[@folio='" + theFolio + "']/@verrou\",Dataset=\"Xml\",Model=\"XML\"]";
var theValue = job.getVariableAsString(xpathString);
theValue;