On this page
How to use variables in Xpath Parser Settings
You might be confused - as I was - about how to use the replacement variables that are offered to you on the Settings for your XPath XML parser page.
You need to put quotes around the variables in order to have them processed.
For instance my last field on this page offers:
The XPath query to run.
The variables $guid, $path_alias, $nid, $title, $field_file, $body, $created are available for replacement.Since I needed the $path value and not the $path with the tags around it, I added the following to my text field:
"http://www.mysite.com$path_alias"
Combining replacement variables
You can combine replacement variables with regular text (like the example above) but also with other replacement variables, like:
"$path_alias$nid"
They cannot be combined with a regular XPath expressions, like so:
/root/document/title "$nid"
If you need a path that is not yet defined in one of your fields and you do not have a use for it by itself, you can create a Temporary target. You do this by creating a regular mapping but instead of choosing a defined target (like “Title” or “Body”) you select “Temporary target”.
Make sure your temporary target is above the combined mapping on the XPath XML parser page, so it can be used in the mappings underneath it.
Now you can define the XPath for the temporary target, f.i.
/root/document/title
And than you can use this temporary target in other mappings, like:
"$Temporary target 1$nid"
Mind the 1, as you can create more temporary targets, and the spaces in the name of the variable, which might look unusual.
Feeds Tamper
Note, if you are having too much trouble making this work - you can also use REGEX to modify your field, if you've set up the Feeds Tamper module.
Help improve this page
You can:
- Log in, click Edit, and edit this page
- Log in, click Discuss, update the Page status value, and suggest an improvement
- Log in and create a Documentation issue with your suggestion