WP All Import uses PHP's XPath 1.0 support to allow for powerful manipulation of your data file during import. This allows you to quickly group and limit what fields are pulled into a particular field. You can also perform simple text replacement.
Note: Most XPath statements that work directly in the SimpleXMLElement::xpath function will work in WP All Import: https://www.php.net/manual/en/simplexmlelement.xpath.php
Note: All XPath statements used in WP All Import must be wrapped in curly braces or they won't be interpreted as XPath - {elementOrExpression}
Note: If typing text into the import configuration with literal curly braces, the opening curly brace must be escaped with a backslash - {something}
What is XPath?
Officially, 'XPath is a language for addressing parts of an XML document...': https://www.w3.org/TR/1999/REC-xpath-19991116/What that means in practice is that XPath is what's used 'behind the scenes' in WP All Import to group and iterate through the data from your import file. Because of that, you have the opportunity to use custom XPath expressions to manipulate file data during the import.
But How Do I Use It?
Say you have an import file with some image elements like this:
You could drag those elements to the Images section one by one, which is fine if you only have a few and there's always the same number of image elements:
However, what do you do if you have dozens per record and each record could have any number of image elements? That's where the power of XPath can greatly simplify your import configuration.
Here's an XPath statement that would grab all of the images, regardless of number in each record:
{./*[starts-with(local-name(), 'image')]}
It would simply be placed in the Images section:
Additional Resources
https://www.ibm.com/developerworks/library/x-xpathphp/index.html
https://www.w3schools.com/xml/xpath_intro.asp
Related
Inline PHP
FOREACH Loops
IF Statements