Switch Variables in XML Location Path

Post Reply
numnational
Member
Posts: 38
Joined: Tue Sep 30, 2014 3:28 pm

Switch Variables in XML Location Path

Post 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.
jan_suhr
Advanced member
Posts: 592
Joined: Fri Nov 04, 2011 1:12 pm
Location: Nyköping, Sweden

Re: Switch Variables in XML Location Path

Post 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.
Jan Suhr
Color Consult AB
Sweden
=============
Check out my apps
numnational
Member
Posts: 38
Joined: Tue Sep 30, 2014 3:28 pm

Re: Switch Variables in XML Location Path

Post by numnational »

Thanks for your answer but i have the same error...
jan_suhr
Advanced member
Posts: 592
Joined: Fri Nov 04, 2011 1:12 pm
Location: Nyköping, Sweden

Re: Switch Variables in XML Location Path

Post 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.
Jan Suhr
Color Consult AB
Sweden
=============
Check out my apps
numnational
Member
Posts: 38
Joined: Tue Sep 30, 2014 3:28 pm

Re: Switch Variables in XML Location Path

Post 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
allsystems
Newbie
Posts: 6
Joined: Fri Mar 16, 2018 12:33 pm

Re: Switch Variables in XML Location Path

Post 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;
Post Reply